/* ===== Токены и темы ===== */
:root {
  --accent: #3040F2;
  color-scheme: light;
  --bg: #F3F4F6;
  --card: #FFFFFF;
  --ink: #14161B;
  --muted: #5B616E;
  --line: #E3E5EA;
  --field: #7C8392;
  --field-bg: #ECEEF4;
  --avatar: #E3E5EA;
  --danger: #B42318;
  --success: #067647;
  --accent-ink: var(--accent);
  --accent-soft: color-mix(in srgb, var(--accent) 12%, white);
  --success-soft: color-mix(in srgb, var(--success) 16%, transparent);
  --shadow: 0 8px 28px rgb(20 22 27 / 0.16);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E1014;
  --card: #181B21;
  --ink: #F2F3F5;
  --muted: #A0A7B4;
  --line: #2B303A;
  --field: #6F7685;
  --field-bg: #232731;
  --avatar: #2B303A;
  --danger: #F97066;
  --success: #47CD89;
  --accent-ink: color-mix(in srgb, var(--accent) 40%, white);
  --accent-soft: color-mix(in srgb, var(--accent) 30%, #181B21);
  --shadow: 0 8px 28px rgb(0 0 0 / 0.5);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0E1014;
    --card: #181B21;
    --ink: #F2F3F5;
    --muted: #A0A7B4;
    --line: #2B303A;
    --field: #6F7685;
    --field-bg: #232731;
  --field-bg: #232731;
    --avatar: #2B303A;
    --danger: #F97066;
    --success: #47CD89;
    --accent-ink: color-mix(in srgb, var(--accent) 40%, white);
    --accent-soft: color-mix(in srgb, var(--accent) 30%, #181B21);
    --shadow: 0 8px 28px rgb(0 0 0 / 0.5);
  }
}

/* ===== База ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Onest', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.num { font-variant-numeric: tabular-nums; }
.display { font-family: 'Unbounded', sans-serif; font-weight: 700; }

/* ===== Оболочка мобильного приложения ===== */
/* Экран приложения закреплён по краям видимой области: в установленном приложении на Android высота 100dvh
   бывает больше видимой части (снизу системная полоса), и нижнее меню уезжало за край — приходилось скроллить */
.phone {
  position: fixed;
  inset: 0;
  max-width: 430px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}
.screen {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: calc(24px + env(safe-area-inset-top)) 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: none;
}
.screen::-webkit-scrollbar { display: none; }
.screen > * { flex: none; }

/* ===== Шапка ===== */
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 0 4px; }
.topbar__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.topbar__date { font-size: 14px; color: var(--muted); }
.topbar__title { margin: 0; font-size: 20px; line-height: 28px; }
.logo { flex: none; display: flex; align-items: center; gap: 8px; height: 28px; white-space: nowrap; }
.logo__mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.logo__word { font-family: 'Unbounded', sans-serif; font-weight: 700; font-size: 15px; letter-spacing: 0.02em; }

.title-edit { display: flex; align-items: center; gap: 6px; min-height: 44px; margin: -8px 0; }
.title-edit input {
  flex: 1; min-width: 0; height: 44px; padding: 0; border: 0;
  border-bottom: 1.5px dashed var(--field); background: transparent;
  font-family: 'Unbounded', sans-serif; font-weight: 700; font-size: 18px;
  text-overflow: ellipsis;
}
.title-edit input:focus { outline: none; border-bottom: 2px solid var(--accent-ink); }
.title-edit svg { flex: none; color: var(--muted); }

/* ===== Карточки и плашки ===== */
.card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px; border-radius: 18px;
  background: var(--card); border: 1px solid var(--line);
}
.card--group { gap: 10px; }
.card--done { border-color: color-mix(in srgb, var(--success) 40%, var(--line)); }
.note { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); }
.note__label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; }
.note__text { font-size: 14px; line-height: 1.4; }

.banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 14px;
  background: var(--card); border: 1.5px solid var(--ink);
  font-size: 14px; line-height: 1.4;
}
.banner svg { flex: none; }

/* ===== Кнопки ===== */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 16px; border: 0; border-radius: 14px;
  font-size: 16px; font-weight: 600; text-decoration: none;
}
.btn--primary { background: var(--accent); color: #FFFFFF; }
.btn--ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn--dashed { background: transparent; color: var(--accent-ink); border: 1.5px dashed var(--accent-ink); border-radius: 12px; }
.btn--dashed-muted { background: transparent; color: var(--ink); border: 1.5px dashed var(--field); font-size: 15px; }
.btn--text { height: 44px; background: transparent; color: var(--muted); font-size: 14px; }
.btn--danger { background: transparent; color: var(--danger); border: 1.5px solid currentColor; }
.btn--big { height: 56px; font-size: 17px; }

.icon-btn {
  flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 12px;
  background: transparent; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
}

/* ===== Упражнение ===== */
.ex-head { display: flex; align-items: flex-start; gap: 4px; margin-bottom: 4px; }
.ex-head__main {
  flex: 1; min-width: 0; min-height: 52px; padding: 2px 0 0; border: 0; background: transparent;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; text-align: left;
}
.ex-head__names { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ex-name { font-size: 21px; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
.ex-plan { font-size: 13px; color: var(--muted); }
.ex-pill {
  flex: none; align-self: center; display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; font-weight: 700;
}
.ex-pill--done { background: var(--success-soft); color: var(--success); }
.ex-head__chev { flex: none; height: 44px; display: flex; align-items: center; color: var(--muted); }

.menu { display: flex; flex-direction: column; gap: 4px; padding: 6px; margin-bottom: 6px; border-radius: 14px; background: var(--bg); }
.menu__item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-height: 56px; padding: 8px 12px; border: 0; border-radius: 10px;
  background: transparent; text-align: left;
}
.menu__title { font-size: 15px; font-weight: 600; }
.menu__sub { font-size: 13px; color: var(--muted); }

.sets-head, .set-row {
  display: grid; grid-template-columns: 40px 1fr 1fr 44px; gap: 8px; align-items: center;
}
.sets-head { font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; }
.set-row__n {
  justify-self: center; width: 28px; height: 28px; border-radius: 50%; background: var(--bg);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--muted);
}
.set-row__n--next { background: var(--accent); color: #FFFFFF; }
.sets-head, .set-row, .set-done { grid-template-columns: 40px 1fr 1fr 44px; }

/* Записанный подход: только чтение, нажатие открывает правку */
.set-done {
  display: grid; gap: 8px; align-items: center;
  width: 100%; min-height: 48px; padding: 0; border: 0; border-radius: 12px;
  background: transparent; text-align: center;
}
.set-done:hover { background: var(--bg); }
.set-done__val { font-family: 'Unbounded', sans-serif; font-size: 17px; font-weight: 600; }
.set-done__val--soft { font-family: 'Onest', sans-serif; font-size: 14px; font-weight: 500; color: var(--muted); }
.set-done__ok {
  justify-self: center; width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: var(--success-soft); color: var(--success);
}

.field {
  width: 100%; min-width: 0; height: 52px; padding: 0;
  border: 2px solid transparent; border-radius: 14px; background: var(--field-bg);
  text-align: center; font-family: 'Unbounded', sans-serif; font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums;
  caret-color: var(--accent-ink); transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}
.field::placeholder { color: var(--muted); font-family: 'Onest', sans-serif; font-size: 14px; font-weight: 500; }
.field:focus { outline: none; border-color: var(--accent-ink); background: var(--card); box-shadow: 0 0 0 4px var(--accent-soft); }
.field--sm { height: 48px; font-size: 17px; }
.field--edit { height: 44px; font-size: 17px; }
.field--error, .field--error:focus { border-color: var(--danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 18%, transparent); }
.field-error { font-size: 13px; color: var(--danger); padding-left: 48px; }

.ok-btn {
  width: 44px; height: 52px; padding: 0; border: 0; border-radius: 14px;
  background: var(--accent); color: #FFFFFF;
  display: flex; align-items: center; justify-content: center;
}
.edit-actions { display: flex; gap: 8px; padding-left: 48px; }
.edit-actions .btn { flex: 1; height: 44px; font-size: 14px; border-radius: 12px; }

/* ===== Сет (суперсет / трисет) ===== */
.chip {
  align-self: flex-start; padding: 3px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 700;
}
.group-list { display: flex; flex-direction: column; gap: 8px; }
.group-item { display: flex; align-items: baseline; gap: 8px; }
.group-item__n { flex: none; width: 18px; font-size: 14px; font-weight: 600; color: var(--accent-ink); }
.group-item__name { font-size: 18px; font-weight: 600; line-height: 1.25; }
.round-head, .round-row { display: grid; grid-template-columns: 1fr 68px 68px; gap: 8px; align-items: center; }
.round-head { font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; }
.round-head span:first-child { text-align: left; }
.round { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.round--done {
  width: 100%; padding: 8px 0 4px; border: 0; border-top: 1px solid var(--line);
  background: transparent; text-align: left;
}
.round__title { display: flex; align-items: center; justify-content: space-between; min-height: 28px; font-size: 13px; font-weight: 700; color: var(--muted); }
.round__title--next { color: var(--accent-ink); }
.round__done { display: inline-flex; align-items: center; gap: 6px; color: var(--success); }
.round__edit { font-size: 13px; font-weight: 600; color: var(--accent-ink); }
.round-row__name { font-size: 14px; line-height: 1.25; min-width: 0; }
.round-row__val { text-align: center; font-family: 'Unbounded', sans-serif; font-size: 15px; font-weight: 600; }

/* ===== Свёрнутые и пропущенные ===== */
.ex-closed {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 68px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 18px;
  background: var(--card); text-align: left;
}
.ex-closed__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ex-closed__name { font-size: 18px; font-weight: 700; line-height: 1.25; }
.ex-closed__text { flex: 1; }
.st {
  flex: none; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}
.st--part { border-color: var(--accent-ink); color: var(--accent-ink); }
.st--done { border: 0; background: var(--success); color: #FFFFFF; }
.st--skip { border-style: dashed; border-color: var(--field); color: var(--muted); }
.st--skip svg { width: 14px; height: 14px; }
.ex-closed__sub { font-size: 13px; color: var(--muted); }
.ex-closed--done .ex-closed__sub { color: var(--success); font-weight: 600; }
.ex-closed__icon { flex: none; color: var(--muted); }
.ex-closed--done .ex-closed__name { color: var(--muted); }
.ex-skipped {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 18px; background: var(--card); border: 1.5px dashed var(--field);
}
.ex-skipped .btn { flex: none; height: 44px; font-size: 14px; border-radius: 12px; }

.empty { gap: 12px; padding: 20px; }
.empty__title { font-size: 18px; font-weight: 600; }
.empty__text { font-size: 14px; line-height: 1.5; color: var(--muted); }

.finish-hint { margin: -4px 0 0; text-align: center; font-size: 13px; color: var(--muted); }

/* ===== Нижнее меню ===== */
.tabbar {
  flex: none; display: flex; gap: 8px;
  padding: 8px 16px calc(8px + max(14px, env(safe-area-inset-bottom)));
  background: var(--card); border-top: 1px solid var(--line);
}
.tabbar__item {
  flex: 1; height: 52px; padding: 0; border: 0; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: none;
}
.tabbar__item[aria-current="page"] { color: var(--accent-ink); font-weight: 700; }
/* Активная вкладка — подложка под иконкой */
.tabbar__item svg { box-sizing: content-box; padding: 3px 18px; border-radius: 999px; transition: background-color 150ms ease; }
.tabbar__item[aria-current="page"] svg { background: var(--accent-soft); }

/* ===== Тост с «Вернуть» ===== */
.toast {
  position: absolute; left: 16px; right: 16px; bottom: calc(92px + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 52px; padding: 4px 4px 4px 16px; border-radius: 14px;
  background: var(--ink); color: var(--bg); box-shadow: var(--shadow);
  font-size: 15px; z-index: 20;
  animation: toast-in 180ms ease-out;
}
.toast button {
  flex: none; height: 44px; padding: 0 14px; border: 0; border-radius: 10px;
  background: transparent; color: var(--bg); font-weight: 700; text-decoration: underline;
}
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }

/* ===== Нижний лист (выбор упражнения, подтверждение) ===== */
.sheet-backdrop {
  position: absolute; inset: 0; z-index: 30;
  background: rgb(14 16 20 / 0.45);
  display: flex; flex-direction: column; justify-content: flex-end;
  animation: fade-in 150ms ease-out;
}
.sheet {
  max-height: 88%; display: flex; flex-direction: column; gap: 12px;
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0; background: var(--card);
  animation: sheet-in 200ms ease-out;
}
.sheet__grip { align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--line); }
.sheet__title { margin: 4px 0 0; font-size: 20px; font-weight: 600; }
.sheet__text { margin: 0; font-size: 15px; line-height: 1.5; color: var(--muted); }
.sheet__actions { display: flex; flex-direction: column; gap: 8px; }
.search {
  display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 14px;
  border: 1.5px solid var(--field); border-radius: 14px; background: var(--card);
}
.search:focus-within { border-color: var(--accent-ink); box-shadow: 0 0 0 4px var(--accent-soft); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; font-size: 17px; }
.search input:focus { outline: none; }
.search svg { flex: none; color: var(--muted); }
.pick-list { flex: 1; min-height: 120px; overflow-y: auto; margin: 0 -16px; padding: 0 16px; display: flex; flex-direction: column; }
.pick {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 56px; padding: 8px 4px; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; text-align: left; font-size: 17px; font-weight: 500;
}
.pick--create { color: var(--accent-ink); font-weight: 600; }
.pick-empty { padding: 16px 4px; font-size: 14px; color: var(--muted); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0.6; } }

/* ===== Итог тренировки ===== */
.summary { gap: 16px; padding-top: 8px; }
.summary__badge {
  width: 64px; height: 64px; border-radius: 20px; background: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.summary__title { margin: 0; font-size: 28px; line-height: 1.2; }
.summary__sub { margin: -8px 0 0; font-size: 15px; color: var(--muted); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.stat__value { font-family: 'Unbounded', sans-serif; font-weight: 700; font-size: 26px; }
.stat__label { font-size: 13px; color: var(--muted); }
.progress-list { display: flex; flex-direction: column; }
.progress-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.progress-row:last-child { border-bottom: 0; }
.progress-row__name { font-size: 16px; font-weight: 600; }
.progress-row__sub { display: block; margin-top: 2px; font-size: 13px; font-weight: 400; color: var(--muted); }
.progress-row__delta { flex: none; font-size: 16px; font-weight: 700; color: var(--success); }
.progress-row__delta--same { color: var(--muted); font-weight: 500; font-size: 14px; }
.section-label { margin: 4px 4px -4px; font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: 0.02em; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
}

/* ===== История ===== */
.select-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 60px; padding: 8px 16px; border: 1.5px solid var(--field); border-radius: 16px;
  background: var(--card); text-align: left;
}
.select-btn__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.select-btn__label { font-size: 12px; font-weight: 600; color: var(--muted); }
.select-btn__value { font-size: 17px; font-weight: 600; }
.select-btn svg { flex: none; color: var(--muted); }

.chart { gap: 12px; }
.chart .select-btn { min-height: 56px; border-color: var(--line); background: var(--bg); }
.section-title { margin: 8px 4px -2px; font-family: 'Unbounded', sans-serif; font-weight: 700; font-size: 17px; }
.chart__head { display: flex; flex-direction: column; gap: 2px; }
.chart__title { font-size: 17px; font-weight: 600; }
.chart__sub { font-size: 13px; color: var(--muted); }
.chart__trend { margin-top: 6px; font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.chart__delta { padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); font-weight: 700; }
.chart__delta--flat { background: var(--bg); color: var(--muted); font-weight: 600; }
.chart__empty { margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.chart svg { display: block; overflow: visible; }
.chart__grid line { stroke: var(--line); stroke-width: 1; }
.chart__axis text { fill: var(--muted); font-size: 12px; font-family: 'Onest', sans-serif; }
.chart__line { fill: none; stroke: var(--accent-ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart__dot { fill: var(--accent-ink); }
.chart__dot--last { stroke: var(--card); stroke-width: 2; }
.chart__label { fill: var(--ink); font-size: 13px; font-weight: 700; font-family: 'Onest', sans-serif; }

.hist-group { display: flex; flex-direction: column; gap: 8px; }
.hist-group__title { margin: 4px 4px 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.hist-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 72px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--card); color: var(--ink); text-align: left; text-decoration: none;
}
.hist-item svg { flex: none; color: var(--muted); }
.hist-item--live { border: 1.5px solid var(--accent-ink); }
.hist-item__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hist-item__meta { font-size: 13px; color: var(--muted); }
.hist-item__name { font-size: 16px; font-weight: 600; }
.hist-item__sub { font-size: 14px; color: var(--muted); }
.hist-item__go { flex: none; font-size: 14px; font-weight: 600; color: var(--accent-ink); }

.sheet--tall { max-height: 90%; background: var(--bg); }
.sheet__head { display: flex; align-items: flex-start; gap: 12px; padding: 0 4px; }
.sheet__scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; scrollbar-width: none; }
.sheet__scroll > * { flex: none; }
.icon-btn--filled { background: var(--card); color: var(--ink); }
.hist-ex { gap: 6px; padding: 14px 16px; }
.hist-ex__name { font-size: 17px; font-weight: 600; line-height: 1.25; }
.tag { align-self: flex-start; padding: 3px 10px; border: 1.5px solid var(--ink); border-radius: 12px; font-size: 13px; font-weight: 600; }
.set-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.set-chip { display: flex; flex-direction: column; align-items: center; min-width: 72px; padding: 8px 12px; border-radius: 10px; background: var(--bg); }
.set-chip__n { font-size: 12px; color: var(--muted); }
.set-chip__v { font-size: 16px; font-weight: 600; }
.pick__meta { flex: none; font-size: 13px; color: var(--muted); }
.pick--on { color: var(--accent-ink); font-weight: 700; }
.hist-more {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 56px; padding: 0 16px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--card); font-size: 15px; font-weight: 600;
}
.hist-more__icon { flex: none; display: flex; color: var(--muted); }
.hist-older { display: flex; flex-direction: column; gap: 8px; }

/* ===== Техника ===== */
.search input::-webkit-search-cancel-button { display: none; }
.tech-list { display: flex; flex-direction: column; gap: 12px; }
.tech-list > * { flex: none; }
.tech-count { padding: 0 4px; font-size: 13px; color: var(--muted); }
.tech-item { display: flex; flex-direction: column; border-radius: 18px; background: var(--card); border: 1px solid var(--line); overflow: hidden; }
.tech-item__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 68px; padding: 12px 16px; border: 0; background: transparent; text-align: left;
}
.tech-item__name { font-size: 18px; font-weight: 600; line-height: 1.25; }
.tech-item__chev { flex: none; display: flex; color: var(--muted); transition: transform 150ms ease; }
.tech-item__chev--open { transform: rotate(180deg); }
.tech-item__body { display: flex; flex-direction: column; gap: 10px; padding: 0 16px 16px; }
.tech-item__body .btn { border-radius: 12px; }
.tech-item__hint { font-size: 13px; line-height: 1.4; color: var(--muted); }

/* ===== Вход ===== */
.screen--login { padding: calc(28px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom)); gap: 24px; }
.logo--big { height: 36px; gap: 10px; }
.logo--big .logo__mark { width: 36px; height: 36px; border-radius: 10px; }
.logo--big .logo__mark svg { width: 22px; height: 22px; }
.logo--big .logo__word { font-size: 18px; }
.login__intro { display: flex; flex-direction: column; gap: 12px; margin-top: 32px; }
.login__title { margin: 0; font-size: 28px; line-height: 1.2; }
.login__text { margin: 0; font-size: 16px; line-height: 1.5; color: var(--muted); }
.login__text strong { color: var(--ink); font-weight: 600; word-break: break-all; }
.login__form { display: flex; flex-direction: column; gap: 10px; }
.login__label { font-size: 14px; font-weight: 600; }
.login__input {
  height: 56px; padding: 0 16px; border: 1.5px solid var(--field); border-radius: 14px;
  background: var(--card); font-size: 18px;
}
.login__input:focus { outline: none; border-color: var(--accent-ink); box-shadow: 0 0 0 4px var(--accent-soft); }
.login__input--error, .login__input--error:focus { border-color: var(--danger); box-shadow: none; }
.login__error { font-size: 14px; line-height: 1.4; color: var(--danger); }
.login__info { font-size: 14px; line-height: 1.4; color: var(--success); }
.login__form .btn--big { margin-top: 6px; }
.login__form .btn:disabled { opacity: 0.55; cursor: default; }
.login__form .btn--text:disabled { opacity: 1; }

/* Одно настоящее поле поверх шести ячеек: работает вставка и автоподстановка кода из SMS/письма */
.otp { position: relative; }
.otp__input {
  position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0;
  background: transparent; color: transparent; caret-color: transparent;
  font-size: 16px; letter-spacing: 3em; opacity: 0.01; z-index: 1;
}
.otp__cells { display: flex; gap: 10px; }
.otp__cell {
  flex: 1; min-width: 0; height: 60px; border: 1.5px solid var(--field); border-radius: 12px; background: var(--card);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Unbounded', sans-serif; font-weight: 700; font-size: 24px;
}
.otp__cell--filled { border-color: var(--ink); }
.otp__input:focus + .otp__cells .otp__cell--active { border: 2px solid var(--accent-ink); box-shadow: 0 0 0 4px var(--accent-soft); }
.otp__cell--error { border-color: var(--danger); }

.install { display: flex; gap: 14px; padding: 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.install__icon { flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; }
.install__text { display: flex; flex-direction: column; gap: 4px; }
.install__title { font-size: 15px; font-weight: 600; }
.install__sub { font-size: 14px; line-height: 1.45; color: var(--muted); }

/* ===== Неделя программы ===== */
.wk-list { display: flex; flex-direction: column; gap: 8px; }
.wk {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 10px 14px;
  border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); text-align: left; text-decoration: none; color: var(--ink);
}
.wk--on { border: 2px solid var(--accent-ink); background: var(--accent-soft); }
.wk > svg { flex: none; color: var(--muted); }
.wk__n {
  flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--bg);
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700;
}
.wk__n--done { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); }
.wk__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wk__title { font-size: 16px; font-weight: 600; }
.wk__extra { font-size: 12px; font-weight: 600; color: var(--muted); }
.wk__status { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.wk__status--done { color: var(--success); font-weight: 600; }
.wk__now { flex: none; padding: 2px 8px; border-radius: 8px; background: var(--accent); color: #FFFFFF; font-size: 12px; font-weight: 700; }
.wk-row { display: flex; align-items: center; gap: 4px; }
.wk-row .wk { flex: 1; min-width: 0; }
.wk-del { width: 48px; height: 48px; }
.round-row__plan { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }

/* Невидимый противовес справа от текста, размером с иконку слева: по центру кнопки оказывается сам текст */
.btn__balance { flex: none; width: 20px; }

/* ===== Прогресс тренировки под заголовком ===== */
.wp { display: flex; flex-direction: column; gap: 6px; padding: 0 4px; margin-top: -2px; }
.wp__bar { display: flex; gap: 4px; }
.wp__seg { flex: 1; height: 6px; border-radius: 3px; background: var(--line); transition: background-color 200ms ease; }
.wp__seg--part { background: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.wp__seg--done { background: var(--accent); }
.wp__seg--skip { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); } /* не делал — пустой контур */
.wp__text { font-size: 13px; color: var(--muted); }

/* ===== Поверхности браузера в цветах приложения ===== */
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--ink); }
input, textarea { caret-color: var(--accent-ink); }

/* ===== Тренировки недели: полоска под заголовком ===== */
.wkstrip { display: flex; flex-direction: column; gap: 8px; }
.wkstrip__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px; }
.wkstrip__text { display: flex; flex-direction: column; }
.wkstrip__title { font-size: 14px; font-weight: 700; }
.wkstrip__hint { font-size: 12px; color: var(--muted); }
.wkstrip__add {
  flex: none; min-height: 36px; padding: 0 12px; border: 1.5px dashed var(--field); border-radius: 999px;
  background: transparent; font-size: 13px; font-weight: 600;
}
/* три тренировки недели помещаются целиком; если больше (свои сверх плана) — листаются */
.wkstrip__row {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(100px, 1fr); gap: 8px;
  overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; padding-bottom: 2px;
}
.wkstrip__row::-webkit-scrollbar { display: none; }
.wkc {
  scroll-snap-align: start; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-width: 0; min-height: 84px; padding: 10px 10px 8px; border: 1.5px solid var(--line); border-radius: 16px;
  background: var(--card); text-align: left; transition: border-color 150ms ease, background-color 150ms ease;
}
.wkc:active { transform: scale(0.98); }
.wkc__n {
  width: 24px; height: 24px; margin-bottom: 4px; border-radius: 50%; background: var(--bg);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--muted);
}
.wkc__title { max-width: 100%; font-size: 14px; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wkc__status { font-size: 12px; color: var(--muted); white-space: nowrap; }
.wkc--on { border-color: var(--accent); background: var(--accent); color: #FFFFFF; }
.wkc--on .wkc__n { background: rgb(255 255 255 / 0.22); color: #FFFFFF; }
.wkc--on .wkc__status { color: rgb(255 255 255 / 0.85); }
.wkc--done .wkc__n { background: var(--success); color: #FFFFFF; }
.wkc--done .wkc__status { color: var(--success); font-weight: 600; }

/* ---------- «Доступ закрыт» и нет связи (cloud-client.js) ---------- */
.cloud-closed { justify-content: center; gap: 16px; padding: 24px 16px; }
.cloud-closed h1 { margin: 0; font-size: 26px; }
.cloud-closed p { margin: 0; color: var(--muted); line-height: 1.5; }

/* ---------- Связь с базой (cloud-trainer.js, cloud-client.js) ---------- */
.cloud-status {
  position: fixed; left: 16px; bottom: 16px; z-index: 60; max-width: calc(100vw - 32px);
  padding: 10px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line);
  font-size: 14px; font-weight: 600; color: var(--muted); box-shadow: 0 6px 20px rgb(0 0 0 / .12);
}
.cloud-status[data-kind="idle"], .cloud-status:empty { display: none; }
.cloud-status[data-kind="failed"] { color: var(--danger, #C62828); border-color: currentColor; }

/* ---------- Заставка при запуске (boot.js) ---------- */
/* Фон как в манифесте (#0E1014): продолжает системную заставку Android без скачка */
.boot {
  position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  background: #0E1014; transition: opacity .45s ease;
}
/* Размер — как у плитки на системной заставке Android: иконка ярлыка там ~72% ширины экрана, плитка — 56% её (≈ 40,3%).
   Без тени и с той же гантелью, что на иконке, — чтобы смена системной заставки на эту была незаметна */
.boot__icon { width: min(40.3vw, 240px); height: auto; aspect-ratio: 1; border-radius: 22.5%; animation: boot-pulse 1.8s ease-in-out .7s infinite; }
/* Плитка ровно по центру, как на системной заставке; надпись — под ней, не сдвигая плитку */
.boot__word { position: absolute; left: 0; right: 0; top: calc(50% + min(20.15vw, 120px) + 28px); text-align: center;
  font-family: 'Unbounded', sans-serif; font-weight: 700; font-size: clamp(22px, 7vw, 32px); letter-spacing: .14em; color: #fff; animation: boot-word .7s cubic-bezier(.2, .8, .2, 1) .25s both; }
.boot--out { opacity: 0; pointer-events: none; }
.boot--out .boot__icon { animation: boot-out .45s ease both; }
@keyframes boot-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes boot-word { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes boot-out { to { opacity: 0; transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) {
  .boot__icon, .boot__word, .boot--out .boot__icon { animation: none; }
}

/* ---------- Предпросмотр программы до её начала (preview.js) ---------- */
.pv-day { gap: 6px; }
.pv-day__n { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pv-day__title { margin: 0; font-size: 20px; line-height: 1.25; }
.pv-day__meta { font-size: 13px; color: var(--muted); }
.pv-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.pv-ex { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.pv-list .pv-list .pv-ex:first-child { border-top: 0; }
.pv-ex__name { font-size: 15px; font-weight: 600; min-width: 0; }
.pv-ex__plan { flex: none; font-size: 14px; color: var(--muted); }
.pv-group { padding: 8px 12px; margin: 4px 0; border-radius: 12px; background: var(--accent-soft); }
.pv-group__label { font-size: 13px; font-weight: 700; color: var(--accent-ink); }
.pv-group .pv-list { margin-top: 2px; }
.pv-own { justify-content: center; text-align: center; text-decoration: none; }

/* ---------- «Неделя выполнена» (workout.js) ---------- */
.wkdone { flex-direction: row; align-items: flex-start; gap: 10px; background: color-mix(in srgb, var(--success) 14%, var(--card)); }
.wkdone__icon { flex: none; display: flex; color: var(--success); padding-top: 1px; }
.wkc--static { cursor: default; }
.wkc--static:active { transform: none; }
.stats--3 { grid-template-columns: repeat(3, 1fr); }
.wkdone__history { align-self: center; color: var(--accent-ink); }
/* Полоса и перед сетом: у упражнения сверху — такая же линия, как у упражнения после сета */
.pv-ex:has(+ .pv-group) { border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.pv-ex + .pv-group { margin-top: 8px; }
.pv-group + .pv-ex { margin-top: 4px; }
