/* Обучение и первоначальная настройка (onboarding.js). Полноэкранный слой
   поверх приложения; токены — из base.css / theme.css. */

body.onboarding-open { overflow: hidden; }
body.onboarding-open .bottom-nav { display: none; }

.onboarding {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; flex-direction: column;
  padding: max(16px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  background: var(--bg); color: var(--text);
  overflow-y: auto;
}
.onb-top, .onb-body, .onb-actions, .onb-status { width: 100%; max-width: 440px; margin-inline: auto; }
.onb-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.onb-dots { display: flex; gap: 6px; }
.onb-dot { width: 6px; height: 6px; border-radius: 3px; background: var(--line); transition: width 300ms var(--spring, ease), background-color 300ms ease; }
.onb-dot.is-active { width: 22px; background: var(--accent); }
.onb-skip { padding-right: 0; color: var(--text-dim); }

.onb-body { flex: 1 0 auto; display: flex; flex-direction: column; justify-content: center; padding-block: 24px; }
.onb-enter > * { animation: onb-in 420ms var(--spring, cubic-bezier(.2, .8, .2, 1)) both; }
.onb-enter > *:nth-child(2) { animation-delay: 40ms; }
.onb-enter > *:nth-child(3) { animation-delay: 80ms; }
.onb-enter > *:nth-child(4) { animation-delay: 120ms; }
@keyframes onb-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .onb-enter > * { animation: none; } .onb-dot { transition: none; } }

.onb-title { font-size: clamp(28px, 8vw, 34px); line-height: 1.1; letter-spacing: -.04em; font-weight: 600; margin: 0; outline: none; }
.onb-lead { margin-top: 12px; font-size: 16px; line-height: 1.5; color: var(--text-dim); }
.onb-mark { display: grid; place-items: center; width: 72px; height: 72px; margin-bottom: 28px; border-radius: 22px; background: var(--accent); color: var(--on-accent); font-size: 50px; font-weight: 650; padding-bottom: 8px; }
.onb-mark-done { font-size: 34px; padding-bottom: 0; }
.onb-icon { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 24px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); }
.onb-icon svg { width: 30px; height: 30px; }
.onb-tip { margin-top: 24px; padding: 14px 16px; border-radius: 14px; background: var(--surface); font-size: 14px; line-height: 1.45; color: var(--text); }
.onb-tip b { font-weight: 600; }

.onb-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.onb-topics { margin-top: 24px; }
.onb-chip { min-height: 40px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--text); font: inherit; font-size: 14px; font-weight: 500; }
.onb-chip[aria-pressed="true"], .onb-chip[aria-checked="true"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.onb-chip[aria-pressed="true"]::before { content: '✓ '; }
.onb-loading { color: var(--text-dim); font-size: 14px; }

.onb-delivery { margin-top: 28px; }
.onb-readout { padding: 20px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); }
.onb-readout .onb-readout-label { font-size: 13px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.onb-readout .onb-readout-count { margin-top: 6px; font-size: 28px; font-weight: 600; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.onb-readout-hint { margin-top: 6px; font-size: 14px; color: var(--text-dim); line-height: 1.4; }

.onb-slider { margin-top: 24px; }

/* Ползунок (smoothSlider в onboarding.js). Положение бегунка — --p от 0
   до 1; при перетаскивании он идёт за пальцем без анимации (.is-dragging),
   а после отпускания пружинисто доезжает до ступени. */
.onb-range {
  --p: .5;
  --spring: cubic-bezier(.34, 1.36, .64, 1);
  position: relative; height: 44px; touch-action: none; cursor: grab; outline: none;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
}
.onb-range.is-pressed { cursor: grabbing; }
.onb-range-track { position: absolute; left: 0; right: 0; top: 50%; height: 6px; margin-top: -3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.onb-range-fill { position: absolute; inset: 0 auto 0 0; width: calc(14px + (100% - 28px) * var(--p)); background: var(--accent); border-radius: inherit; transition: width 420ms var(--spring); }
.onb-range-stops { position: absolute; inset: 0; pointer-events: none; }
.onb-range-stop { position: absolute; top: 50%; left: calc(14px + (100% - 28px) * var(--at)); width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%; background: var(--field-border); transition: background-color 200ms ease; }
.onb-range-stop.is-filled { background: rgba(255, 255, 255, .7); }
.onb-range-thumb {
  position: absolute; top: 50%; left: calc(14px + (100% - 28px) * var(--p));
  width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 0.5px 4px rgba(0, 0, 0, .12), 0 6px 13px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04);
  transition: left 420ms var(--spring), transform 200ms var(--spring), box-shadow 200ms ease;
}
.onb-range.is-dragging .onb-range-thumb, .onb-range.is-dragging .onb-range-fill { transition: none; }
.onb-range.is-pressed .onb-range-thumb { transform: scale(1.12); box-shadow: 0 1px 6px rgba(0, 0, 0, .14), 0 10px 22px rgba(0, 0, 0, .16), 0 0 0 .5px rgba(0, 0, 0, .04); }
.onb-range:focus-visible .onb-range-thumb { box-shadow: 0 0 0 3px var(--accent-tint, rgba(10, 102, 255, .25)), 0 6px 13px rgba(0, 0, 0, .12); }
.onb-range.is-custom .onb-range-thumb { background: var(--surface); }
.onb-range.is-custom .onb-range-fill { opacity: .35; }
@media (prefers-reduced-motion: reduce) {
  .onb-range-thumb, .onb-range-fill { transition: none; }
}
/* Центр бегунка ходит от 14px до «ширина − 14px» (бегунок 28px), поэтому
   подпись ставится туда же: 14px + (100% − 28px) × позиция. Крайние
   прижаты к краям, чтобы не вылезать за ширину. */
.onb-ticks { position: relative; height: 36px; margin-top: 4px; }
.onb-tick { position: absolute; top: 0; left: calc(14px + (100% - 28px) * var(--at)); transform: translateX(-50%); min-height: 36px; padding: 4px 2px; border: 0; background: none; color: var(--text-dim); font: inherit; font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.onb-tick:first-child { left: 0; transform: none; }
.onb-tick:last-child { left: auto; right: 0; transform: none; }
.onb-tick[aria-pressed="true"] { color: var(--accent); font-weight: 600; }

.onb-flex-toggle { margin-top: 12px; padding-left: 0; }
.onb-flex { display: grid; gap: 18px; margin-top: 8px; padding: 18px; border-radius: 18px; background: var(--surface); }
.onb-flex[hidden] { display: none; }
.onb-field-label { font-size: 14px; font-weight: 550; margin-bottom: 10px; }
.onb-field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.onb-field-row .onb-field-label { margin-bottom: 0; }
.onb-field.is-disabled { opacity: .45; }
.onb-flex .onb-chip { min-height: 36px; padding: 6px 12px; font-size: 13px; }
.onb-stepper { display: flex; align-items: center; gap: 4px; }
.onb-step { width: 40px; height: 40px; min-height: 40px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); font-size: 20px; line-height: 1; }
.onb-step:disabled { opacity: .4; }
.onb-step-value { min-width: 32px; text-align: center; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }

.onb-switch { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.onb-switch-text { display: grid; gap: 2px; font-size: 14px; font-weight: 550; }
.onb-switch-text small { font-size: 12px; font-weight: 400; color: var(--text-dim); }
.onb-switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.onb-switch-track { flex: 0 0 auto; position: relative; width: 50px; height: 30px; border-radius: 15px; background: var(--field-border); transition: background-color 200ms ease; }
.onb-switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform 250ms var(--spring, ease); }
.onb-switch-input:checked + .onb-switch-track { background: var(--accent); }
.onb-switch-input:checked + .onb-switch-track::after { transform: translateX(20px); }
.onb-switch-input:focus-visible + .onb-switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

.onb-status { min-height: 20px; font-size: 13px; color: var(--text-dim); }
.onb-status:empty { min-height: 0; }
.onb-actions { display: flex; gap: 10px; padding-top: 12px; }
.onb-back { min-height: 52px; padding: 0 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text); font: inherit; font-weight: 550; }
.onb-next { flex: 1; min-height: 52px; border-radius: 14px; font-size: 16px; }

/* Смена чисел и слов как в iOS (rollingNumber, blurText в onboarding.js).
   Уходящие копии вынесены из потока (absolute), поэтому размер контейнера
   сразу равен новому тексту — onboarding.js плавно ведёт его к этому
   размеру, а соседние слова не прыгают. */
.roll-number { display: inline-flex; font-variant-numeric: tabular-nums; white-space: nowrap; }
.roll-cell { position: relative; display: inline-block; }
.roll-glyph { display: inline-block; will-change: transform, filter, opacity; }
.roll-out { position: absolute; left: 0; top: 0; }
.blur-text { position: relative; display: inline-block; white-space: nowrap; vertical-align: bottom; }
p.blur-text { display: block; white-space: normal; }
.blur-text > span { display: inline-block; transform-origin: left center; will-change: transform, filter, opacity; }
p.blur-text > span { display: block; }
.blur-text > .blur-out { position: absolute; left: 0; top: 0; width: max-content; max-width: none; }
p.blur-text > .blur-out { width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
