/* ============================================================
   LexoreTranslate — статичный mockup (2030 / Apple-grade)
   Темы: light · dark · aurora
   ============================================================ */

/* --- Переменные тем --- */
/* ============================================================
   Общие стили текста (владелец, 2026-11-23): один набор на все страницы. Ни одна страница
   не задаёт размер, жирность и межбуквенное расстояние текста сама: берёт один из стилей.
   Лозунг 36/1.2/600 · Заголовок страницы 34/1.1/600 · Заголовок блока 22/1.25/600 ·
   Крупный пункт 17/1.3/600 · Обычный текст 15/1.5/400 · Пояснение 14/1.45/400 ·
   Мелкий текст 13/1.5/400 · Подпись 12/1.4/400. Шрифт: Inter, запасные как прежде.
   ============================================================ */
:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  --t-slogan-fs: 36px; --t-slogan-lh: 1.2; --t-slogan-fw: 600; --t-slogan-ls: -0.02em;
  --t-title-fs: 34px; --t-title-lh: 1.1; --t-title-fw: 600; --t-title-ls: -0.02em;
  --t-block-fs: 22px; --t-block-lh: 1.25; --t-block-fw: 600; --t-block-ls: -0.01em;
  --t-item-fs: 17px; --t-item-lh: 1.3; --t-item-fw: 600; --t-item-ls: 0;
  --t-body-fs: 15px; --t-body-lh: 1.5; --t-body-fw: 400; --t-body-ls: 0;
  --t-note-fs: 14px; --t-note-lh: 1.45; --t-note-fw: 400; --t-note-ls: 0;
  --t-small-fs: 13px; --t-small-lh: 1.5; --t-small-fw: 400; --t-small-ls: 0;
  --t-caption-fs: 12px; --t-caption-lh: 1.4; --t-caption-fw: 400; --t-caption-ls: 0;
  /* только страница «О сервисе» (2026-11-23): большой заголовок, заголовок раздела, текст статьи, надпись */
  --t-hero-fs: 56px; --t-hero-lh: 1.08; --t-hero-fw: 600; --t-hero-ls: -0.03em;
  --t-section-fs: 24px; --t-section-lh: 1.25; --t-section-fw: 600; --t-section-ls: -0.01em;
  --t-article-fs: 17px; --t-article-lh: 1.65; --t-article-fw: 400; --t-article-ls: 0;
  --t-label-fs: 13px; --t-label-lh: 1.4; --t-label-fw: 500; --t-label-ls: 0.02em;
  /* глоссарии (2026-11-23): заголовок варианта и термин в панели, название в списке */
  --t-option-fs: 20px; --t-option-lh: 1.3; --t-option-fw: 600; --t-option-ls: -0.01em;
  --t-row-fs: 16px; --t-row-lh: 1.4; --t-row-fw: 600; --t-row-ls: 0;
}
.t-slogan { font-size: var(--t-slogan-fs); line-height: var(--t-slogan-lh); font-weight: var(--t-slogan-fw); letter-spacing: var(--t-slogan-ls); color: var(--text-primary); }
.t-title { font-size: var(--t-title-fs); line-height: var(--t-title-lh); font-weight: var(--t-title-fw); letter-spacing: var(--t-title-ls); color: var(--text-primary); }
.t-block { font-size: var(--t-block-fs); line-height: var(--t-block-lh); font-weight: var(--t-block-fw); letter-spacing: var(--t-block-ls); color: var(--text-primary); }
.t-item { font-size: var(--t-item-fs); line-height: var(--t-item-lh); font-weight: var(--t-item-fw); letter-spacing: var(--t-item-ls); color: var(--text-primary); }
.t-body { font-size: var(--t-body-fs); line-height: var(--t-body-lh); font-weight: var(--t-body-fw); letter-spacing: var(--t-body-ls); }
.t-note { font-size: var(--t-note-fs); line-height: var(--t-note-lh); font-weight: var(--t-note-fw); letter-spacing: var(--t-note-ls); color: var(--text-secondary); }
.t-small { font-size: var(--t-small-fs); line-height: var(--t-small-lh); font-weight: var(--t-small-fw); letter-spacing: var(--t-small-ls); color: var(--text-secondary); }
.t-caption { font-size: var(--t-caption-fs); line-height: var(--t-caption-lh); font-weight: var(--t-caption-fw); letter-spacing: var(--t-caption-ls); color: var(--text-secondary); }
.t-hero { font-size: var(--t-hero-fs); line-height: var(--t-hero-lh); font-weight: var(--t-hero-fw); letter-spacing: var(--t-hero-ls); color: var(--text-primary); }
.t-section { font-size: var(--t-section-fs); line-height: var(--t-section-lh); font-weight: var(--t-section-fw); letter-spacing: var(--t-section-ls); color: var(--text-primary); }
.t-article { font-size: var(--t-article-fs); line-height: var(--t-article-lh); font-weight: var(--t-article-fw); letter-spacing: var(--t-article-ls); color: color-mix(in srgb, var(--text-primary) 78%, transparent); }
.t-label { font-size: var(--t-label-fs); line-height: var(--t-label-lh); font-weight: var(--t-label-fw); letter-spacing: var(--t-label-ls); color: var(--text-secondary); }

:root,
[data-theme="light"] {
  --bg-base: #f4f6fb;
  --text-primary: #0d1117;
  --text-secondary: rgba(13, 17, 23, 0.55);
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(255, 255, 255, 0.85);
  --glass-shadow: 0 8px 32px rgba(100, 120, 180, 0.12);
  --accent: #3b6cff;
  --accent-glow: rgba(59, 108, 255, 0.35);
  --blob-1: rgba(120, 180, 255, 0.45);
  --blob-2: rgba(180, 140, 255, 0.35);
  --blob-3: rgba(100, 220, 240, 0.3);
  --grain-opacity: 0.04;
  --orb-core: linear-gradient(135deg, #6b9fff, #a78bfa);
  --ring-color: rgba(59, 108, 255, 0.25);
  --switcher-fg: #1a1f28;
  --switcher-fg-muted: #4a5260;
  --switcher-fg-active: #0d1117;
  --switcher-glass-bg: rgba(255, 255, 255, 0.78);
  --switcher-glass-border: rgba(255, 255, 255, 0.95);
  --switcher-indicator: rgba(59, 108, 255, 0.14);
  --switcher-glyph: #1a1f28;
  --switcher-highlight: rgba(255, 255, 255, 0.65);
  --switcher-trigger-shadow: 0 4px 18px rgba(59, 108, 255, 0.18);
  --qa-serious-fg: #b42318;
  --qa-serious-bg: rgba(217, 45, 32, 0.12);
  --qa-minor-fg: #4a5260;
  --qa-minor-bg: rgba(74, 82, 96, 0.1);
}

[data-theme="dark"] {
  --bg-base: #0a0c14;
  --text-primary: #eef1f8;
  --text-secondary: rgba(238, 241, 248, 0.5);
  --glass-bg: rgba(18, 22, 38, 0.65);
  --glass-border: rgba(120, 140, 220, 0.18);
  --glass-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
  --accent: #7b9fff;
  --accent-glow: rgba(123, 159, 255, 0.4);
  --blob-1: rgba(60, 80, 200, 0.35);
  --blob-2: rgba(120, 50, 180, 0.3);
  --blob-3: rgba(40, 120, 200, 0.25);
  --grain-opacity: 0.06;
  --orb-core: linear-gradient(135deg, #5b7fff, #9b6bff);
  --ring-color: rgba(123, 159, 255, 0.2);
  --switcher-fg: #eef1f8;
  --switcher-fg-muted: rgba(238, 241, 248, 0.62);
  --switcher-fg-active: #ffffff;
  --switcher-glass-bg: rgba(22, 28, 48, 0.72);
  --switcher-glass-border: rgba(140, 160, 230, 0.28);
  --switcher-indicator: rgba(123, 159, 255, 0.22);
  --switcher-glyph: #eef1f8;
  --switcher-highlight: rgba(255, 255, 255, 0.12);
  --switcher-trigger-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  --qa-serious-fg: #ff9b93;
  --qa-serious-bg: rgba(255, 110, 100, 0.16);
  --qa-minor-fg: rgba(238, 241, 248, 0.72);
  --qa-minor-bg: rgba(238, 241, 248, 0.1);
}

[data-theme="aurora"] {
  --bg-base: #080a12;
  --text-primary: #f0f4ff;
  --text-secondary: rgba(240, 244, 255, 0.55);
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-shadow: 0 16px 64px rgba(0, 0, 0, 0.35);
  --accent: #5eead4;
  --accent-glow: rgba(94, 234, 212, 0.35);
  --blob-1: rgba(45, 212, 191, 0.4);
  --blob-2: rgba(167, 139, 250, 0.45);
  --blob-3: rgba(244, 114, 182, 0.35);
  --grain-opacity: 0.07;
  --orb-core: linear-gradient(135deg, #2dd4bf, #a78bfa, #f472b6);
  --ring-color: rgba(94, 234, 212, 0.22);
  --switcher-fg: #f0f4ff;
  --switcher-fg-muted: rgba(240, 244, 255, 0.58);
  --switcher-fg-active: #ffffff;
  --switcher-glass-bg: rgba(255, 255, 255, 0.09);
  --switcher-glass-border: rgba(255, 255, 255, 0.2);
  --switcher-indicator: rgba(94, 234, 212, 0.2);
  --switcher-glyph: #f0f4ff;
  --switcher-highlight: rgba(255, 255, 255, 0.14);
  --switcher-trigger-shadow: 0 4px 22px rgba(94, 234, 212, 0.2);
  --qa-serious-fg: #ffa39b;
  --qa-serious-bg: rgba(255, 120, 110, 0.16);
  --qa-minor-fg: rgba(240, 244, 255, 0.75);
  --qa-minor-bg: rgba(240, 244, 255, 0.1);
}

/* --- База --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
}

body {
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  font-family: var(--font-sans);
  font-size: var(--t-body-fs);
  line-height: var(--t-body-lh);
  background: var(--bg-base);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  transition: background 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              color 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Aurora background --- */
.aurora-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--bg-base);
  transition: background 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.aurora-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.85;
  will-change: transform;
}

.blob-1 {
  width: 55vw;
  height: 55vw;
  max-width: 700px;
  max-height: 700px;
  background: var(--blob-1);
  top: -15%;
  left: -10%;
  animation: drift-1 28s ease-in-out infinite;
}

.blob-2 {
  width: 45vw;
  height: 45vw;
  max-width: 600px;
  max-height: 600px;
  background: var(--blob-2);
  bottom: -20%;
  right: -5%;
  animation: drift-2 24s ease-in-out infinite;
}

.blob-3 {
  width: 35vw;
  height: 35vw;
  max-width: 480px;
  max-height: 480px;
  background: var(--blob-3);
  top: 40%;
  left: 35%;
  animation: drift-3 22s ease-in-out infinite;
}

@keyframes drift-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(8%, 12%) scale(1.08); }
  66%      { transform: translate(-5%, 6%) scale(0.95); }
}

@keyframes drift-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  40%      { transform: translate(-10%, -8%) scale(1.1); }
  70%      { transform: translate(6%, -12%) scale(0.92); }
}

@keyframes drift-3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(12%, -10%) scale(1.15); }
}

/* --- Film grain --- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  transition: opacity 0.6s ease;
}

/* --- Layout --- */
.app {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* the fixed top bar (44px + 1.25rem) stays clear of the logo */
  padding: 5.5rem 1.5rem 2rem;
  gap: 1.75rem;
}

/* --- Top bar: About on the left, Profile + settings on the right --- */
.topbar {
  position: fixed;
  top: 1.25rem;
  left: 1.25rem;
  right: 1.25rem;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}

.topbar > *,
.topbar-right > * {
  pointer-events: auto;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Логотип в шапке: «Lexore» жирный градиентом, «Translate» тонкий; клик — на главную */
.brand-logo {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 0.6rem 0 0.3rem;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.03em;
  line-height: 1;
  font-size: 1.35rem;
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand-logo:hover {
  transform: translateY(-1px) scale(1.03);
}

.brand-logo-name {
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.brand-logo-word {
  font-weight: 300;
  color: var(--text-primary);
  opacity: 0.85;
}

/* Логотип — ДВОЙНОЙ: «LexoreTranslate / LexoreBusiness» (правка владельца 26.10).
   Первым стоит раздел, в котором пользователь сейчас; он выделен, второй приглушён.
   Шрифт чуть меньше одиночного логотипа, а вся конструкция из двух названий шире
   него примерно в полтора раза. Слэш — серый и тоньше текста. */
.brand-pair {
  display: inline-flex;
  align-items: center;
  gap: 0.18rem;
}

.brand-pair .brand-logo {
  font-size: 1rem;
  padding: 0 0.12rem;
}

.brand-slash {
  font-weight: 300;
  font-size: 0.95rem;
  color: var(--text-primary);
  opacity: 0.32;
}

/* приглушён ровно так же, как обычная ссылка рядом с активной */
.brand-logo-part.is-dim { opacity: 0.45; }
.brand-logo-part.is-dim:hover { opacity: 0.8; }

/* Профиль в шапке — круглая кнопка с первой буквой имени или почты (пункт 1
   задания владельца). Тот же компонент .topbar-btn, только круглый. */
.topbar-btn.topbar-avatar {
  width: 44px;
  padding: 0;
  justify-content: center;
  gap: 0;
  font-size: var(--t-item-fs); line-height: var(--t-item-lh); letter-spacing: var(--t-item-ls);
  font-weight: 700;
}

/* Шестерёнка в шапке — такая же кнопка, только одним значком; ведёт в раздел
   настроек внутри профиля (отдельной страницы настроек нет). */
.topbar-btn.topbar-gear {
  width: 44px;
  padding: 0;
  justify-content: center;
  gap: 0;
}

/* Планшет и уже: у одиночного логотипа остаётся «Lexore»; у двойного оба названия
   нужны целиком — иначе получилось бы «Lexore / Lexore» */
@media (max-width: 900px) {
  .brand-logo-word { display: none; }
  .brand-pair .brand-logo-word { display: inline; }
  .brand-pair .brand-logo { font-size: 0.92rem; }
}

/* Телефон: у второго названия остаётся только «Translate»/«Business» —
   «LexoreTranslate / Business» читается и помещается в одну строку */
@media (max-width: 640px) {
  .brand-pair .brand-logo { font-size: 0.82rem; }
  .brand-pair .brand-logo-part.is-dim .brand-logo-name { display: none; }
  .brand-logo { font-size: 1rem; padding: 0 0.3rem 0 0; height: 40px; }
  .topbar-left, .topbar-right { gap: 0.4rem; }
  /* подписи не помещаются — остаются значки (у профиля буква) */
  .topbar-btn { padding: 0; width: 40px; justify-content: center; gap: 0; }
  .topbar-btn span { display: none; }
  .topbar-btn.topbar-avatar { width: 40px; }
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 44px;
  padding: 0 1.1rem 0 0.95rem;
  border-radius: 999px;
  color: var(--switcher-fg);
  font-size: var(--t-note-fs); line-height: var(--t-note-lh); letter-spacing: var(--t-note-ls);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.35s ease, color 0.3s ease;
}

.topbar-btn > * {
  position: relative;
  z-index: 1;
}

.topbar-btn svg {
  color: var(--accent);
  flex-shrink: 0;
}

.topbar-btn:hover {
  transform: translateY(-1px) scale(1.03);
  color: var(--switcher-fg-active);
  box-shadow:
    var(--switcher-trigger-shadow),
    0 8px 32px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 0 0 2px var(--accent-glow);
}

.topbar-btn:active {
  transform: scale(0.98);
}

.topbar-btn.is-current {
  box-shadow:
    var(--switcher-trigger-shadow),
    0 8px 32px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 0 0 2px var(--accent-glow);
}

/* --- Glass primitives --- */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  transition: background 0.5s ease, border-color 0.5s ease, box-shadow 0.4s ease,
              transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.glass-pill {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

/* --- Liquid glass --- */
.liquid-glass {
  position: relative;
  isolation: isolate;
  background:
    linear-gradient(145deg, var(--switcher-highlight) 0%, transparent 42%),
    var(--switcher-glass-bg);
  backdrop-filter: blur(28px) saturate(1.65);
  -webkit-backdrop-filter: blur(28px) saturate(1.65);
  border: 1px solid var(--switcher-glass-border);
  box-shadow:
    var(--switcher-trigger-shadow),
    0 8px 32px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.06);
}

.liquid-glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    120% 80% at 12% 0%,
    rgba(255, 255, 255, 0.42) 0%,
    transparent 55%
  );
  pointer-events: none;
  z-index: 0;
}

/* --- Settings widget --- */
.settings-widget {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  z-index: 100;
}

.settings-widget.is-open {
  z-index: 110;
}

.settings-panel-wrap {
  /* out of the top-bar flow: the closed 0fr track still measures 252px in
     intrinsic sizing and pushed the gear off a phone screen */
  position: absolute;
  top: 0;
  right: calc(100% + 10px);
  display: grid;
  grid-template-columns: 0fr;
  transition: grid-template-columns 0.58s cubic-bezier(0.32, 0.72, 0, 1);
}

.settings-widget.is-open .settings-panel-wrap {
  grid-template-columns: 1fr;
}

.settings-panel {
  overflow: hidden;
  min-width: 0;
  width: 252px;
  border-radius: 22px;
  padding: 1rem;
  opacity: 0;
  transform: translateX(16px) scale(0.94);
  transform-origin: right top;
  transition:
    opacity 0.42s cubic-bezier(0.32, 0.72, 0, 1),
    transform 0.58s cubic-bezier(0.32, 0.72, 0, 1);
  pointer-events: none;
}

.settings-widget.is-open .settings-panel {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
}

.settings-trigger {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--switcher-glyph);
  transition:
    transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.35s ease;
}

.settings-trigger svg {
  z-index: 1;
}

.settings-trigger:hover {
  transform: scale(1.06);
}

.settings-trigger:active {
  transform: scale(0.96);
}

.settings-widget.is-open .settings-trigger {
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 0 0 2px var(--accent-glow);
}

.settings-section + .settings-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--switcher-glass-border);
}

.settings-heading {
  font-size: var(--t-caption-fs); line-height: var(--t-caption-lh); letter-spacing: var(--t-caption-ls);
  font-weight: 600;
  text-transform: uppercase;
  color: var(--switcher-fg-muted);
  margin-bottom: 0.55rem;
}

.settings-segment {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

[data-theme="dark"] .settings-segment,
[data-theme="aurora"] .settings-segment {
  background: rgba(255, 255, 255, 0.06);
}

.settings-segment-indicator {
  position: absolute;
  top: 4px;
  left: 0;
  height: calc(100% - 8px);
  width: 0;
  background: var(--switcher-indicator);
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
  pointer-events: none;
  will-change: transform, width;
}

.settings-segment-btn {
  position: relative;
  z-index: 1;
  flex: 1;
  border: none;
  background: transparent;
  color: var(--switcher-fg-muted);
  font-family: inherit;
  font-size: var(--t-caption-fs); line-height: var(--t-caption-lh); letter-spacing: var(--t-caption-ls);
  font-weight: 500;
  padding: 0.45rem 0.5rem;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.28s ease;
}

.settings-segment-btn:hover {
  color: var(--switcher-fg);
}

.settings-segment-btn.active {
  color: var(--switcher-fg-active);
  font-weight: 600;
}

.settings-segment.is-pressed .settings-segment-btn.active {
  transform: scale(0.98);
}

.settings-lang-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 220px;
  overflow-y: auto;
  margin: 0 -0.35rem;
  padding: 0 0.35rem;
  scrollbar-width: thin;
  scrollbar-color: var(--switcher-fg-muted) transparent;
}

.settings-lang-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--switcher-fg-muted);
  font-family: inherit;
  font-size: var(--t-small-fs); line-height: var(--t-small-lh); letter-spacing: var(--t-small-ls);
  font-weight: 500;
  text-align: left;
  padding: 0.52rem 0.65rem;
  border-radius: 12px;
  cursor: pointer;
  transition:
    background 0.22s ease,
    color 0.22s ease;
}

.settings-lang-item:hover {
  background: var(--switcher-indicator);
  color: var(--switcher-fg);
}

.settings-lang-item.active {
  background: var(--switcher-indicator);
  color: var(--switcher-fg-active);
  font-weight: 600;
}

.settings-lang-item.active::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  flex-shrink: 0;
  margin-left: 0.5rem;
}

/* --- Hero --- */
.hero {
  text-align: center;
  width: 100%;
  max-width: 100%;
  padding: 0 1rem;
}

.logo {
  --logo-size: clamp(2.4rem, 5vw, 3.5rem);
  --logo-lh: 1.05;
  display: block;
  text-align: center;
  white-space: nowrap;
  max-width: 100%;
  font-size: var(--logo-size);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: var(--logo-lh);
}

.logo-brand {
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
}

.logo-prefix,
.logo-suffix {
  font-size: var(--logo-size);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: var(--logo-lh);
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.logo-prefix-stage {
  display: inline-block;
  vertical-align: baseline;
  position: relative;
  overflow: hidden;
  line-height: var(--logo-lh);
  flex: 0 0 auto;
  transition: width 0.4s cubic-bezier(0.45, 0.05, 0.2, 1);
}

.logo-prefix-measure {
  position: absolute;
  left: 0;
  top: 0;
  visibility: hidden;
  white-space: nowrap;
  font: inherit;
  line-height: var(--logo-lh);
  pointer-events: none;
  user-select: none;
}

.logo-prefix {
  display: inline-block;
  vertical-align: baseline;
  white-space: nowrap;
  font: inherit;
  line-height: inherit;
  transition: opacity 0.45s cubic-bezier(0.45, 0.05, 0.2, 1);
}

.logo-suffix {
  flex: 0 0 auto;
}

@media (prefers-reduced-motion: reduce) {
  .logo-prefix-stage,
  .logo-prefix {
    transition: none;
  }

  .logo-prefix-measure {
    display: none;
  }
}

.tagline {
  margin-top: 0.5rem;
  font-size: var(--t-body-fs); line-height: var(--t-body-lh); letter-spacing: var(--t-body-ls);
  font-weight: 300;
  color: var(--text-secondary);
}

/* --- Language selector (custom dropdown) --- */
.lang-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lang-picker {
  position: relative;
}

.lang-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1.05rem;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  font-family: inherit;
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
}

.lang-chip:hover,
.lang-picker.is-open .lang-chip {
  transform: scale(1.02);
  box-shadow: var(--glass-shadow), 0 0 24px var(--accent-glow);
}

.lang-label {
  font-size: var(--t-caption-fs); line-height: var(--t-caption-lh); letter-spacing: var(--t-caption-ls);
  font-weight: 500;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.lang-chip-value {
  font-size: var(--t-body-fs); line-height: var(--t-body-lh); letter-spacing: var(--t-body-ls);
  font-weight: 500;
  color: var(--text-primary);
}

.lang-chip-caret {
  color: var(--text-secondary);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  flex-shrink: 0;
}

.lang-picker.is-open .lang-chip-caret {
  transform: rotate(180deg);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  z-index: 60;
  min-width: 168px;
  max-height: 288px;
  overflow-y: auto;
  padding: 0.4rem;
  border-radius: 18px;
  transform: translateX(-50%) translateY(-6px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.26s cubic-bezier(0.32, 0.72, 0, 1),
              transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  scrollbar-width: thin;
  scrollbar-color: var(--switcher-fg-muted) transparent;
}

.lang-menu[hidden] {
  display: block;
  visibility: hidden;
}

.lang-picker.is-open .lang-menu {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
  pointer-events: auto;
}

.lang-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--switcher-fg-muted);
  font-family: inherit;
  font-size: var(--t-note-fs); line-height: var(--t-note-lh); letter-spacing: var(--t-note-ls);
  font-weight: 500;
  text-align: left;
  padding: 0.5rem 0.7rem;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.lang-menu-item:hover {
  background: var(--switcher-indicator);
  color: var(--switcher-fg);
}

.lang-menu-item.active {
  background: var(--switcher-indicator);
  color: var(--switcher-fg-active);
  font-weight: 600;
}

.lang-menu-item.active::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  flex-shrink: 0;
  margin-left: 0.6rem;
}

/* "Detect automatically" heads the source list, set off from the languages */
.lang-menu-item.is-auto {
  margin-bottom: 0.35rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--switcher-glass-border);
  border-radius: 12px 12px 4px 4px;
  color: var(--accent);
}

.lang-picker.is-auto .lang-chip-value {
  color: var(--accent);
}

.lang-arrow {
  border: none;
  background: none;
  padding: 0.3rem;
  border-radius: 50%;
  color: var(--text-secondary);
  opacity: 0.6;
  cursor: pointer;
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lang-arrow:hover {
  opacity: 1;
  transform: scale(1.12);
  color: var(--accent);
}

.lang-arrow:active {
  transform: scale(0.94) rotate(180deg);
}

/* --- Drop stage (state container) --- */
.drop-stage {
  width: min(520px, 92vw);
  min-height: 280px;
  position: relative;
  /* height follows the active card (script: syncStageHeight) */
  transition: height 0.45s cubic-bezier(0.32, 0.72, 0, 1);
}

.state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.96) translateY(8px);
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.5s cubic-bezier(0.34, 1.2, 0.64, 1),
              visibility 0.5s;
  pointer-events: none;
}

.state.active {
  opacity: 1;
  visibility: visible;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

/* --- IDLE: dropzone --- */
.dropzone {
  width: 100%;
  padding: 3rem 2rem;
  border-radius: 28px;
  text-align: center;
  cursor: pointer;
  outline: none;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.dragover {
  transform: scale(1.02);
  border-color: var(--accent);
  box-shadow: var(--glass-shadow), 0 0 40px var(--accent-glow);
}

.drop-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 1.25rem;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--accent);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dropzone:hover .drop-icon,
.dropzone.dragover .drop-icon {
  transform: scale(1.08) translateY(-4px);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.dropzone.shake {
  animation: shake 0.35s ease;
}

.drop-title {
  font-size: var(--t-item-fs); line-height: var(--t-item-lh); letter-spacing: var(--t-item-ls);
  font-weight: 600;
}

.drop-sub {
  margin-top: 0.35rem;
  font-size: var(--t-note-fs); line-height: var(--t-note-lh); letter-spacing: var(--t-note-ls);
  font-weight: 300;
  color: var(--text-secondary);
}

.drop-hint {
  display: inline-block;
  margin-top: 1.25rem;
  font-size: var(--t-caption-fs); line-height: var(--t-caption-lh); letter-spacing: var(--t-caption-ls);
  font-weight: 500;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
}

.api-offline-banner {
  width: min(520px, 92vw);
  margin: 0 auto 0.75rem;
  padding: 0.65rem 0.9rem;
  border-radius: 14px;
  font-size: var(--t-caption-fs); line-height: var(--t-caption-lh); letter-spacing: var(--t-caption-ls);
  text-align: center;
  color: #ffb4b4;
  background: rgba(220, 60, 60, 0.12);
  border: 1px solid rgba(255, 120, 120, 0.28);
}

.dropzone.is-disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

/* --- CONFIRM --- */
.confirm-panel {
  width: 100%;
  padding: 2.25rem 2rem;
  border-radius: 28px;
  text-align: center;
}

.confirm-file {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  margin-bottom: 1.1rem;
}

.confirm-file-icon {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--accent);
  flex-shrink: 0;
}

.confirm-file-ext {
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--t-caption-fs); line-height: var(--t-caption-lh); letter-spacing: var(--t-caption-ls);
  font-weight: 700;
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 10px var(--accent-glow);
}

.confirm-file-meta {
  text-align: left;
  min-width: 0;
  max-width: 65%;
}

.confirm-file-name {
  font-size: var(--t-body-fs); line-height: var(--t-body-lh); letter-spacing: var(--t-body-ls);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.confirm-file-size {
  margin-top: 0.15rem;
  font-size: var(--t-caption-fs); line-height: var(--t-caption-lh); letter-spacing: var(--t-caption-ls);
  color: var(--text-secondary);
}

.confirm-langs {
  font-size: var(--t-note-fs); line-height: var(--t-note-lh); letter-spacing: var(--t-note-ls);
  font-weight: 500;
  color: var(--text-secondary);
}

/* Detector note under the language pair */
.confirm-detect {
  margin: 0.55rem auto 0;
  max-width: 34rem;
  font-size: var(--t-small-fs); line-height: var(--t-small-lh); letter-spacing: var(--t-small-ls);
  color: var(--text-secondary);
}

.confirm-detect.is-ok {
  color: var(--accent);
}

.confirm-detect.is-warn {
  color: #f0b35c;
}

[data-theme="light"] .confirm-detect.is-warn {
  color: #b9741a;
}

.confirm-detect.is-wait {
  opacity: 0.8;
  animation: detect-pulse 1.2s ease-in-out infinite;
}

@keyframes detect-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.confirm-question {
  margin-top: 0.9rem;
  font-size: var(--t-item-fs); line-height: var(--t-item-lh); letter-spacing: var(--t-item-ls);
  font-weight: 600;
}

.ocr-toggle {
  margin-top: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--t-note-fs); line-height: var(--t-note-lh); letter-spacing: var(--t-note-ls);
  color: var(--text-secondary, rgba(120, 120, 140, 0.9));
  cursor: pointer;
  user-select: none;
}

/* the class display beats the hidden attribute: the checkbox showed for
   every format, not only PDF */
.ocr-toggle[hidden] {
  display: none;
}

.ocr-toggle input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent, #7c6cff);
  cursor: pointer;
}

.confirm-actions {
  margin-top: 1.5rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 2rem;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--t-body-fs); line-height: var(--t-body-lh); letter-spacing: var(--t-body-ls);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.35s ease;
}

.btn-primary:hover {
  transform: scale(1.04);
  box-shadow: var(--glass-shadow), 0 0 32px var(--accent-glow);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* --- ERROR --- */
.error-panel {
  width: 100%;
  padding: 2.5rem 2rem;
  border-radius: 28px;
  text-align: center;
}

.error-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.1rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ff8f8f;
  background: rgba(220, 60, 60, 0.12);
  border: 1px solid rgba(255, 120, 120, 0.3);
  animation: error-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes error-pop {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.error-title {
  font-size: var(--t-block-fs); line-height: var(--t-block-lh); letter-spacing: var(--t-block-ls);
  font-weight: 700;
}

/* The file the error is about, and the file "Try again" would send
   again: five refusals in a row were read as five different files
   (2026-09-15) because the screen never said which one it kept. */
.error-file {
  margin: 0.55rem auto 0;
  max-width: 44ch;
  font-size: var(--t-small-fs); line-height: var(--t-small-lh); letter-spacing: var(--t-small-ls);
  font-weight: 500;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.btn-file-name {
  display: block;
  max-width: 24ch;
  font-size: var(--t-caption-fs); line-height: var(--t-caption-lh); letter-spacing: var(--t-caption-ls);
  font-weight: 400;
  opacity: 0.8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-file-name:empty {
  display: none;
}

.state-error.dragover .error-panel {
  outline: 2px dashed var(--text-secondary);
  outline-offset: -8px;
}

.error-detail {
  margin: 0.6rem auto 0;
  max-width: 40ch;
  font-size: var(--t-small-fs); line-height: var(--t-small-lh); letter-spacing: var(--t-small-ls);
  color: var(--text-secondary);
  overflow-wrap: break-word;
  max-height: 5.2em;
  overflow: hidden;
}

/* --- PROCESSING --- */
.processing-panel {
  width: 100%;
  padding: 2.5rem 2rem;
  border-radius: 28px;
  text-align: center;
}

.orb-container {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 1.5rem;
}

/* Кольцо прогресса вокруг орбы */
.progress-ring {
  position: absolute;
  inset: -8px;
  width: calc(100% + 16px);
  height: calc(100% + 16px);
  transform: rotate(-90deg);
}

.progress-ring circle {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
}

.progress-ring-track {
  stroke: var(--ring-color);
  opacity: 0.5;
}

.progress-ring-bar {
  stroke: var(--accent);
  stroke-dasharray: 352;
  stroke-dashoffset: 352;
  filter: drop-shadow(0 0 6px var(--accent-glow));
  transition: stroke-dashoffset 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.orb-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--ring-color);
  will-change: transform, opacity;
}

.ring-1 { animation: ring-pulse 3s ease-in-out infinite; }
.ring-2 {
  inset: 12px;
  animation: ring-pulse 3s ease-in-out infinite 0.4s;
}
.ring-3 {
  inset: 24px;
  animation: ring-pulse 3s ease-in-out infinite 0.8s;
}

@keyframes ring-pulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50%      { transform: scale(1.06); opacity: 1; }
}

.orb-core {
  position: absolute;
  inset: 32px;
  border-radius: 50%;
  background: var(--orb-core);
  box-shadow: 0 0 40px var(--accent-glow);
  animation: core-breathe 2.5s ease-in-out infinite;
}

@keyframes core-breathe {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50%      { transform: scale(1.12); opacity: 1; }
}

.orb-particles span {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.7;
  /* частицы ускоряются по мере прогресса (JS задаёт --orbit-ms) */
  animation: particle-orbit var(--orbit-ms, 4s) linear infinite;
}

.orb-particles span:nth-child(1) { top: 0; left: 50%; animation-delay: 0s; }
.orb-particles span:nth-child(2) { top: 25%; right: 0; animation-delay: 0.6s; }
.orb-particles span:nth-child(3) { bottom: 25%; right: 0; animation-delay: 1.2s; }
.orb-particles span:nth-child(4) { bottom: 0; left: 50%; animation-delay: 1.8s; }
.orb-particles span:nth-child(5) { bottom: 25%; left: 0; animation-delay: 2.4s; }
.orb-particles span:nth-child(6) { top: 25%; left: 0; animation-delay: 3s; }

@keyframes particle-orbit {
  0%   { transform: rotate(0deg) translateX(52px) rotate(0deg); opacity: 0.3; }
  50%  { opacity: 1; }
  100% { transform: rotate(360deg) translateX(52px) rotate(-360deg); opacity: 0.3; }
}

.processing-filename {
  font-size: var(--t-note-fs); line-height: var(--t-note-lh); letter-spacing: var(--t-note-ls);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.processing-label {
  font-size: var(--t-small-fs); line-height: var(--t-small-lh); letter-spacing: var(--t-small-ls);
  font-weight: 300;
  color: var(--text-secondary);
}

.processing-percent {
  margin-top: 0.75rem;
  font-size: var(--t-title-fs); line-height: var(--t-title-lh); letter-spacing: var(--t-title-ls);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- DONE --- */
.done-panel {
  position: relative;
  width: 100%;
  padding: 2.5rem 2rem;
  border-radius: 28px;
  text-align: center;
  overflow: hidden;
}

.done-voila {
  font-size: var(--t-title-fs); line-height: var(--t-title-lh); letter-spacing: var(--t-title-ls);
  font-weight: 700;
  background: linear-gradient(120deg, var(--accent), #a78bfa, #f472b6, var(--accent));
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: voila-in 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) 0.55s both,
             voila-shimmer 3.2s linear 1.2s infinite;
}

@keyframes voila-in {
  from { transform: translateY(10px) scale(0.85); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes voila-shimmer {
  from { background-position: 0% 0; }
  to   { background-position: 260% 0; }
}

.voila-sparkles {
  position: absolute;
  top: 4.2rem;
  left: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
}

.voila-sparkles span {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
}

.state-done.active .voila-sparkles span {
  animation: sparkle-fly 0.9s cubic-bezier(0.2, 0.6, 0.35, 1) 0.5s forwards;
}

.voila-sparkles span:nth-child(1) { --fly-x: -74px; --fly-y: -38px; background: #f472b6; }
.voila-sparkles span:nth-child(2) { --fly-x: 78px;  --fly-y: -30px; }
.voila-sparkles span:nth-child(3) { --fly-x: -52px; --fly-y: 34px;  background: #a78bfa; animation-delay: 0.58s !important; }
.voila-sparkles span:nth-child(4) { --fly-x: 58px;  --fly-y: 40px;  background: #fbbf24; animation-delay: 0.62s !important; }
.voila-sparkles span:nth-child(5) { --fly-x: -92px; --fly-y: -4px;  width: 4px; height: 4px; animation-delay: 0.66s !important; }
.voila-sparkles span:nth-child(6) { --fly-x: 96px;  --fly-y: 6px;   width: 4px; height: 4px; background: #f472b6; animation-delay: 0.6s !important; }
.voila-sparkles span:nth-child(7) { --fly-x: -30px; --fly-y: -58px; width: 5px; height: 5px; background: #fbbf24; animation-delay: 0.68s !important; }
.voila-sparkles span:nth-child(8) { --fly-x: 26px;  --fly-y: -64px; width: 5px; height: 5px; background: #a78bfa; animation-delay: 0.55s !important; }

@keyframes sparkle-fly {
  0%   { transform: translate(0, 0) scale(0.4); opacity: 0; }
  18%  { opacity: 1; }
  100% { transform: translate(var(--fly-x), var(--fly-y)) scale(1); opacity: 0; }
}

.success-check {
  width: 72px;
  height: 72px;
  margin: 0 auto 1.25rem;
}

.check-svg {
  width: 100%;
  height: 100%;
}

.check-circle {
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: stroke-draw 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.check-mark {
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: stroke-draw 0.4s cubic-bezier(0.4, 0, 0.2, 1) 0.4s forwards;
}

@keyframes stroke-draw {
  to { stroke-dashoffset: 0; }
}

.done-title {
  font-size: var(--t-block-fs); line-height: var(--t-block-lh); letter-spacing: var(--t-block-ls);
  font-weight: 700;
}

.done-sub {
  margin-top: 0.35rem;
  font-size: var(--t-note-fs); line-height: var(--t-note-lh); letter-spacing: var(--t-note-ls);
  font-weight: 400;
  color: var(--text-secondary);
}

/* --- The quality report under the file name (PDF-590): a summary line and the findings by page --- */
.done-note {
  max-width: 36rem;
  margin: 0.5rem auto 0;
  font-size: var(--t-note-fs); line-height: var(--t-note-lh); letter-spacing: var(--t-note-ls);
}

.done-note[hidden] {
  display: none;
}

.qa-report {
  text-align: left;
  color: var(--text-primary);
}

.qa-summary {
  font-weight: 600;
  text-align: center;
}

.qa-legend {
  margin-top: 0.15rem;
  font-size: var(--t-caption-fs); line-height: var(--t-caption-lh); letter-spacing: var(--t-caption-ls);
  text-align: center;
  color: var(--text-secondary);
}

.qa-list {
  margin-top: 0.6rem;
  max-height: 18rem;
  overflow-y: auto;
  padding: 0.15rem 0.6rem 0.15rem 0.2rem;
  border-top: 1px solid var(--glass-border);
}

.qa-page {
  margin-top: 0.55rem;
}

.qa-page-title {
  font-size: var(--t-small-fs); line-height: var(--t-small-lh); letter-spacing: var(--t-small-ls);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.qa-items {
  list-style: none;
  margin-top: 0.2rem;
}

.qa-item {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.18rem 0;
}

.qa-badge {
  flex: none;
  min-width: 5.2rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  font-size: var(--t-caption-fs); line-height: var(--t-caption-lh); letter-spacing: var(--t-caption-ls);
  font-weight: 600;
  text-align: center;
  color: var(--qa-minor-fg);
  background: var(--qa-minor-bg);
}

.qa-serious .qa-badge {
  color: var(--qa-serious-fg);
  background: var(--qa-serious-bg);
}

.qa-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.qa-where {
  font-weight: 600;
}

.qa-quotes {
  color: var(--text-secondary);
}

.qa-possible {
  color: var(--text-secondary);
  font-style: italic;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .qa-item {
    flex-direction: column;
    gap: 0.1rem;
  }

  .qa-badge {
    min-width: 0;
  }
}

.btn-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.75rem;
  padding: 0.85rem 2rem;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--t-body-fs); line-height: var(--t-body-lh); letter-spacing: var(--t-body-ls);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.35s ease;
}

.btn-download:hover {
  transform: scale(1.04);
  box-shadow: var(--glass-shadow), 0 0 32px var(--accent-glow);
}

.btn-download:active {
  transform: scale(0.98);
}

.btn-reset {
  display: block;
  margin: 1rem auto 0;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: var(--t-small-fs); line-height: var(--t-small-lh); letter-spacing: var(--t-small-ls);
  font-weight: 400;
  cursor: pointer;
  transition: color 0.25s ease;
}

.btn-reset:hover {
  color: var(--text-primary);
}

/* --- Mobile --- */
@media (max-width: 520px) {
  .topbar {
    top: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
  }

  .topbar-btn {
    height: 40px;
    padding: 0 0.85rem 0 0.75rem;
    font-size: var(--t-small-fs); line-height: var(--t-small-lh); letter-spacing: var(--t-small-ls);
  }

  .app {
    padding-top: 4.5rem;
  }

  .settings-panel {
    width: min(252px, calc(100vw - 5.5rem));
  }

  .settings-trigger {
    width: 40px;
    height: 40px;
  }

  .settings-lang-list {
    max-height: 180px;
  }

  .lang-row {
    flex-wrap: wrap;
    justify-content: center;
  }

  .lang-arrow {
    transform: rotate(90deg);
  }

  .dropzone {
    padding: 2rem 1.25rem;
  }
}

/* --- comparison block --- */

/* Первый экран остался первым экраном: логотип — просто div, а единственный
   h1 страницы стоит под ним и не спорит с ним по размеру. */
.hero-title {
  margin-top: 0.7rem;
  font-size: var(--t-block-fs); line-height: var(--t-block-lh); letter-spacing: var(--t-block-ls);
  font-weight: 600;
}

.compare {
  /* тот же слой, что и .app: фон-аврора и зерно лежат ниже */
  position: relative;
  z-index: 2;
  padding: 2rem 1.5rem 5rem;
}

/* display из класса перебивает атрибут hidden (как у .ocr-toggle выше):
   без этого закрытое превью висело поверх страницы и глотало клики */
.compare [hidden],
.cmp-lightbox[hidden] {
  display: none;
}

.cmp-inner {
  max-width: 1080px;
  margin: 0 auto;
}

.cmp-title {
  font-size: var(--t-title-fs); line-height: var(--t-title-lh); letter-spacing: var(--t-title-ls);
  font-weight: 700;
}

.cmp-lead {
  margin-top: 0.5rem;
  max-width: 54ch;
  font-size: var(--t-body-fs); line-height: var(--t-body-lh); letter-spacing: var(--t-body-ls);
  font-weight: 300;
  color: var(--text-secondary);
}

/* --- выбор документа --- */
.cmp-docs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.6rem;
}

.cmp-doc {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.45rem 1rem 0.45rem 0.45rem;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.35s ease, background 0.4s ease;
}

.cmp-doc:hover {
  transform: scale(1.02);
  box-shadow: var(--glass-shadow), 0 0 32px var(--accent-glow);
}

.cmp-doc:active {
  transform: scale(0.99);
}

.cmp-doc.is-active {
  background: var(--glass-bg);
}

.cmp-doc.is-active .cmp-doc-thumb {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 18px var(--accent-glow);
}

.cmp-doc-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 50px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  transition: border-color 0.3s ease, box-shadow 0.35s ease;
}

.cmp-doc-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cmp-doc-text {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.cmp-doc-name {
  font-size: var(--t-note-fs); line-height: var(--t-note-lh); letter-spacing: var(--t-note-ls);
  font-weight: 600;
}

.cmp-doc-hint {
  font-size: var(--t-caption-fs); line-height: var(--t-caption-lh); letter-spacing: var(--t-caption-ls);
  font-weight: 400;
  color: var(--text-secondary);
}

/* --- две панели --- */
.cmp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
  margin-top: 1.1rem;
}

.cmp-panel {
  min-width: 0;
  padding: 1.1rem 1.1rem 1.25rem;
  border-radius: 28px;
}

.cmp-panel-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.cmp-panel-title {
  flex: 0 0 auto;
  font-size: var(--t-caption-fs); line-height: var(--t-caption-lh); letter-spacing: var(--t-caption-ls);
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.cmp-file {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--t-small-fs); line-height: var(--t-small-lh); letter-spacing: var(--t-small-ls);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cmp-expand {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease;
}

.cmp-expand:hover:not([disabled]) {
  transform: scale(1.04);
  box-shadow: var(--glass-shadow), 0 0 32px var(--accent-glow);
}

.cmp-expand[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

.cmp-volume {
  margin-top: 0.55rem;
  font-size: var(--t-caption-fs); line-height: var(--t-caption-lh); letter-spacing: var(--t-caption-ls);
  color: var(--text-secondary);
}

/* --- страница документа / заглушка --- */
.cmp-page {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  width: 100%;
  /* высокая страница не перерастает экран: ширину держит бюджет высоты */
  max-width: calc(72vh * 0.707);
  aspect-ratio: 1 / 1.414;
  margin: 0.75rem auto 0;
  border-radius: 14px;
  border: 1px dashed var(--glass-border);
  background: var(--glass-bg);
}

.cmp-page[data-shape="slide"] {
  aspect-ratio: 16 / 9;
  max-width: 100%;
}

.cmp-page[data-shape="sheet"] {
  aspect-ratio: 1.414 / 1;
  max-width: 100%;
}

.cmp-page.has-preview {
  border-style: solid;
}

.cmp-page-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cmp-pending {
  position: absolute;
  font-size: var(--t-caption-fs); line-height: var(--t-caption-lh); letter-spacing: var(--t-caption-ls);
  color: var(--text-secondary);
}

.cmp-page.has-preview .cmp-pending {
  display: none;
}

/* --- переключатель сервисов (компонент переключателя тем) --- */
.cmp-segment {
  margin-top: 0.9rem;
  /* пять сервисов не влезают в половину строки: сегмент прокручивается,
     поэтому touch-action из .settings-segment здесь снят */
  overflow-x: auto;
  touch-action: pan-x;
  scrollbar-width: none;
}

.cmp-segment::-webkit-scrollbar {
  display: none;
}

.cmp-service-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.cmp-service-btn.is-ours::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 0.4rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  vertical-align: middle;
}

/* --- карусель --- */
.cmp-carousel {
  position: relative;
  margin-top: 0.85rem;
  overflow: hidden;
  border-radius: 20px;
  outline: none;
  touch-action: pan-y;
}

.cmp-carousel:focus-visible {
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.cmp-track {
  display: flex;
  align-items: stretch;
  will-change: transform;
  transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}

.cmp-slide {
  flex: 0 0 100%;
  min-width: 0;
  /* отступы висят на слайде: overflow режет по padding-боксу контейнера,
     и его собственный padding показал бы край соседнего слайда */
  padding: 0.15rem 0.2rem 0.25rem;
}

.cmp-arrow {
  position: absolute;
  top: 38%;
  z-index: 2;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  color: var(--text-primary);
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.35s ease, opacity 0.3s ease;
}

.cmp-arrow-prev { left: 0.35rem; }
.cmp-arrow-next { right: 0.35rem; }

.cmp-arrow:hover:not([disabled]) {
  transform: scale(1.06);
  box-shadow: var(--glass-shadow), 0 0 32px var(--accent-glow);
}

.cmp-arrow[disabled] {
  opacity: 0.28;
  cursor: not-allowed;
}

/* --- подпись под результатом --- */
.cmp-meta {
  margin-top: 0.8rem;
  font-size: var(--t-small-fs); line-height: var(--t-small-lh); letter-spacing: var(--t-small-ls);
  color: var(--text-secondary);
}

.cmp-meta-item::before {
  content: "·";
  margin: 0 0.45em;
  opacity: 0.55;
}

.cmp-meta-item.is-first::before {
  content: none;
}

.cmp-note {
  margin-top: 0.3rem;
  font-size: var(--t-small-fs); line-height: var(--t-small-lh); letter-spacing: var(--t-small-ls);
  color: var(--text-primary);
  opacity: 0.85;
}

.cmp-get {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.85rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-size: var(--t-small-fs); line-height: var(--t-small-lh); letter-spacing: var(--t-small-ls);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease;
}

.cmp-get:hover:not(.is-disabled) {
  transform: scale(1.03);
  box-shadow: var(--glass-shadow), 0 0 32px var(--accent-glow);
}

.cmp-get.is-disabled {
  opacity: 0.38;
  pointer-events: none;
}

/* --- тумблер «что сломалось» --- */
.cmp-flags {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.25rem;
  font-size: var(--t-note-fs); line-height: var(--t-note-lh); letter-spacing: var(--t-note-ls);
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: color 0.25s ease;
}

.cmp-flags:hover {
  color: var(--text-primary);
}

.cmp-flags input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}

.cmp-flags-track {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  transition: border-color 0.3s ease, box-shadow 0.35s ease;
}

.cmp-flags-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s ease;
}

.cmp-flags input:checked + .cmp-flags-track {
  border-color: var(--accent);
  box-shadow: 0 0 18px var(--accent-glow);
}

.cmp-flags input:checked + .cmp-flags-track .cmp-flags-knob {
  transform: translateX(18px);
  background: var(--accent);
}

.cmp-flags input:focus-visible + .cmp-flags-track {
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* Красный только на ошибке: подсветка сломанных мест на результате */
body.show-flags [data-flag] {
  position: relative;
  border-radius: 6px;
  border: 1px solid rgba(255, 120, 120, 0.55);
  background: rgba(220, 60, 60, 0.12);
}

body.show-flags [data-flag]::after {
  content: attr(data-flag);
  position: absolute;
  left: 0;
  bottom: 100%;
  margin-bottom: 4px;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: var(--t-caption-fs); line-height: var(--t-caption-lh); letter-spacing: var(--t-caption-ls);
  font-weight: 600;
  white-space: nowrap;
  color: #ff8f8f;
  background: rgba(220, 60, 60, 0.12);
  border: 1px solid rgba(255, 120, 120, 0.28);
  pointer-events: none;
}

body.show-flags [data-flag=""]::after {
  content: none;
}

/* --- нижняя строка и кнопка --- */
.cmp-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1.1rem;
  margin-top: 1.4rem;
  font-size: var(--t-small-fs); line-height: var(--t-small-lh); letter-spacing: var(--t-small-ls);
  color: var(--text-secondary);
}

.cmp-link {
  color: var(--text-primary);
  text-decoration: none;
  padding-bottom: 1px;
  border-bottom: 1px solid var(--glass-border);
  cursor: pointer;
  transition: color 0.25s ease, border-color 0.25s ease;
}

.cmp-link:hover:not(.is-disabled) {
  color: var(--accent);
  border-color: var(--accent);
}

.cmp-link.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.cmp-cta {
  margin-top: 1.8rem;
}

/* на странице «О нас» кнопка — ссылка на переводчик */
.cmp-cta .btn-primary {
  text-decoration: none;
}

/* --- превью крупнее --- */
.cmp-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  /* трек задан явно: в авто-строке max-height: 100% у картинки не к чему
     привязать, и высокая страница вылезала за экран */
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
  padding: 4rem 1.5rem 2rem;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.cmp-lightbox-img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 14px;
  background: var(--bg-base);
  box-shadow: var(--glass-shadow);
}

.cmp-lightbox-close {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: #fff;
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cmp-lightbox-close:hover {
  transform: scale(1.06);
}

@media (max-width: 880px) {
  .cmp-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .compare {
    padding: 1.5rem 1rem 3.5rem;
  }

  .cmp-doc {
    width: 100%;
  }

  .cmp-page {
    max-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cmp-track,
  .cmp-flags-knob {
    transition: none;
  }
}

/* ============================================================
   Выпадашка языков: поле поиска, основное название на языке
   интерфейса и родное название второй строкой (lang_names.js).
   Те же переменные тем, скругления и шрифт — своих цветов нет.
   ============================================================ */
.lang-menu {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 244px;
  max-height: none;
}

.lang-menu-list {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: 248px;
  scrollbar-width: thin;
  scrollbar-color: var(--switcher-fg-muted) transparent;
}

.lang-search-wrap {
  padding: 0 0 0.35rem;
}

.lang-search {
  width: 100%;
  padding: 0.45rem 0.7rem;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--t-note-fs); line-height: var(--t-note-lh); letter-spacing: var(--t-note-ls);
}

.lang-search::placeholder {
  color: var(--text-secondary);
}

.lang-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.lang-item-text {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
}

.lang-item-name,
.lang-item-native {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lang-item-native {
  font-size: var(--t-caption-fs); line-height: var(--t-caption-lh); letter-spacing: var(--t-caption-ls);
  font-weight: 400;
  color: var(--text-secondary);
}

.lang-menu-empty {
  padding: 0.5rem 0.7rem;
  font-size: var(--t-small-fs); line-height: var(--t-small-lh); letter-spacing: var(--t-small-ls);
  color: var(--text-secondary);
}

.lang-menu-item[hidden] {
  display: none;
}
