/* ============================================================
   TRAINING — premium dark athletic
   Палитра: глубокий графит + электрический лайм.
   Типографика: Barlow Condensed (display) / Inter (UI).
   ============================================================ */
:root {
  --bg: #0b0d10;
  --surface: #14171c;
  --surface-2: #1a1e25;
  --line: rgba(255,255,255,.07);
  --line-strong: rgba(255,255,255,.12);

  --text: #f4f6f8;
  --muted: #9aa3ae;
  --dim: #5f6873;

  --accent: #c9f73f;
  --accent-deep: #a8d926;
  --ink: #10130a;

  --ok: #46d17d;
  --ok-ink: #06210f;

  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;

  --display: "Barlow Condensed", "Inter", sans-serif;
  --body: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;

  --t-fast: 160ms cubic-bezier(.4,0,.2,1);
  --t-med: 240ms cubic-bezier(.4,0,.2,1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); }
body {
  color: var(--text);
  font-family: var(--body);
  font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button { font-family: var(--body); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

svg { display: block; }
.ic { width: 20px; height: 20px; flex: none; }
.ic-s { width: 16px; height: 16px; }
.ic-l { width: 24px; height: 24px; }

#app { min-height: 100vh; display: flex; flex-direction: column; }
#view {
  flex: 1;
  padding: calc(env(safe-area-inset-top) + 20px) 16px 100px;
  animation: view-in var(--t-med) both;
}
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- типографика ---------- */
.display {
  font-family: var(--display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .015em;
  line-height: .96;
}
.overline {
  font-size: 11px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent);
  display: flex; align-items: center; gap: 6px;
}
.section-label {
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--dim); margin: 26px 2px 12px;
}

/* ---------- шапка экрана ---------- */
.hdr { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; min-height: 44px; }
.hdr .back {
  width: 44px; height: 44px; flex: none; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.hdr .back:hover { border-color: var(--line-strong); background: var(--surface-2); }
.hdr h1 { margin: 0; font-family: var(--display); font-size: 26px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; line-height: 1; }
.hdr .sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

.kicker { color: var(--dim); font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 6px; }
.greet { font-family: var(--display); font-size: 30px; font-weight: 700; text-transform: uppercase; line-height: 1; margin-bottom: 20px; }
.greet em { font-style: normal; color: var(--accent); }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--r-lg); padding: 24px 22px 22px;
  background: linear-gradient(165deg, var(--surface-2) 0%, var(--surface) 70%);
  border: 1px solid var(--line);
  margin-bottom: 14px;
}
.hero::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 65%);
}
.hero h2 {
  margin: 10px 0 4px; font-family: var(--display); font-weight: 700;
  font-size: 34px; line-height: .95; text-transform: uppercase; letter-spacing: .01em;
}
.hero .sub { color: var(--muted); font-size: 13.5px; }
.hero .meta { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 6px 12px; font-size: 11px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.chip.solid { background: var(--accent); border-color: var(--accent); color: var(--ink); }

/* прогресс цикла */
.cyc { margin-top: 18px; }
.cyc .bar { height: 6px; border-radius: 6px; background: rgba(255,255,255,.08); overflow: hidden; }
.cyc .bar i { display: block; height: 100%; border-radius: 6px; background: var(--accent); transition: width var(--t-med); }
.cyc .txt { display: flex; justify-content: space-between; color: var(--dim); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin-top: 8px; }

/* ---------- кнопки ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 52px; border: none; border-radius: var(--r-md);
  padding: 15px 18px; font-size: 15px; font-weight: 700; letter-spacing: .01em;
  cursor: pointer; transition: filter var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.btn:active { filter: brightness(.92); }
.btn-primary { background: var(--accent); color: var(--ink); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:disabled { opacity: .5; cursor: default; }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--line-strong); background: var(--surface-2); }
.hero .btn { margin-top: 18px; }

/* ---------- карточки ---------- */
.card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 18px; margin-bottom: 10px; cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.card:hover { border-color: var(--line-strong); background: var(--surface-2); }
.card.accented { border-color: rgba(201,247,63,.45); }
.card-icon {
  width: 44px; height: 44px; flex: none; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; color: var(--accent);
}
.card-body { flex: 1; min-width: 0; }
.card h3 { margin: 0; font-family: var(--display); font-size: 19px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; line-height: 1.05; }
.card p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.card .chev { color: var(--dim); flex: none; }
.badge {
  display: inline-flex; background: var(--accent); color: var(--ink);
  font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 4px; margin-bottom: 8px;
}
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.tag {
  font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px;
}

/* ---------- упражнение ---------- */
.ex {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px; margin-bottom: 10px;
  transition: border-color var(--t-fast);
}
.ex.done { border-color: rgba(70,209,125,.4); }
.ex-top { display: flex; gap: 14px; align-items: flex-start; }
.ex-thumb {
  width: 64px; height: 64px; flex: none; border-radius: var(--r-sm); overflow: hidden; position: relative;
  background: var(--surface-2); border: 1px solid var(--line); cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--dim);
  transition: border-color var(--t-fast);
}
.ex-thumb:hover { border-color: var(--line-strong); }
.ex-thumb video, .ex-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ex-thumb .play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.35); color: #fff;
}
.ex-info { flex: 1; min-width: 0; padding-top: 2px; }
.ex-name { font-weight: 600; font-size: 15px; line-height: 1.3; }
.ex-scheme {
  font-family: var(--display); font-weight: 700; font-size: 16px; letter-spacing: .04em;
  color: var(--accent); margin-top: 3px;
}
.ex-note { color: var(--muted); font-size: 12px; margin-top: 3px; }
.ex-hist { color: var(--dim); font-size: 11.5px; margin-top: 6px; }
.ex-check {
  width: 44px; height: 44px; flex: none; margin: -6px -6px 0 0;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer; color: transparent;
}
.ex-check i {
  width: 28px; height: 28px; border-radius: 8px; border: 1.5px solid var(--dim);
  display: flex; align-items: center; justify-content: center; color: transparent;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.ex.done .ex-check i { background: var(--ok); border-color: var(--ok); color: var(--ok-ink); }

.video-wrap { margin-top: 14px; border-radius: var(--r-sm); overflow: hidden; background: #000; border: 1px solid var(--line); }
.video-wrap video, .video-wrap img { width: 100%; display: block; max-height: 60vh; object-fit: contain; }

/* подходы */
.sets { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.sets-head { display: flex; gap: 8px; padding: 0 0 2px; }
.sets-head .set-num { padding: 0; }
.sets-head span {
  flex: 1; text-align: center; font-size: 10px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--dim);
}
.sets-head .sp { width: 44px; flex: none; }
.set-row { display: flex; align-items: center; gap: 8px; }
.set-num {
  width: 24px; flex: none; text-align: center; color: var(--dim);
  font-family: var(--display); font-size: 15px; font-weight: 600;
}
.set-row input {
  flex: 1; width: 100%; min-width: 0; min-height: 44px;
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--r-sm); padding: 10px 8px; font-size: 16px; font-weight: 600; text-align: center;
  transition: border-color var(--t-fast);
}
.set-row input::placeholder { color: var(--dim); font-weight: 500; }
.set-row input:focus { outline: none; border-color: var(--accent); }
.setdone {
  width: 44px; height: 44px; flex: none; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--bg); color: var(--dim);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.setdone:hover { border-color: var(--line-strong); }
.setdone.on { background: var(--ok); border-color: var(--ok); color: var(--ok-ink); }

/* счётчик выполнения */
.day-progress { margin: 4px 2px 16px; }
.day-progress .txt { display: flex; justify-content: space-between; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin-bottom: 8px; }
.day-progress .txt b { color: var(--muted); }
.day-progress .bar { height: 4px; border-radius: 4px; background: rgba(255,255,255,.07); overflow: hidden; }
.day-progress .bar i { display: block; height: 100%; background: var(--ok); border-radius: 4px; transition: width var(--t-med); }

.savebar {
  position: sticky; bottom: 88px; z-index: 5;
  display: flex; flex-direction: column; gap: 10px; padding-top: 10px;
  background: linear-gradient(to top, var(--bg) 55%, transparent);
}

/* ---------- статистика ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 16px 15px; }
.stat .n { font-family: var(--display); font-size: 40px; font-weight: 700; line-height: .9; letter-spacing: .01em; }
.stat .n small { font-size: 20px; color: var(--muted); font-weight: 600; }
.stat .l { color: var(--dim); font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin-top: 8px; }
.stat.accent { background: var(--accent); border-color: var(--accent); }
.stat.accent .n { color: var(--ink); }
.stat.accent .l { color: rgba(16,19,10,.65); }

.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  font-size: 13.5px; min-height: 48px;
}
.row .d { color: var(--muted); flex: none; }
.row .r { color: var(--text); font-weight: 600; text-align: right; }
.row.tap { cursor: pointer; transition: border-color var(--t-fast), background var(--t-fast); }
.row.tap:hover { border-color: var(--line-strong); background: var(--surface-2); }
.row .chev { color: var(--dim); flex: none; }

/* график */
.chart { display: flex; align-items: flex-end; gap: 5px; height: 140px; margin: 16px 2px 6px; }
.chart .bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; position: relative; }
.chart .bar-v { background: var(--accent); border-radius: 4px 4px 2px 2px; min-height: 4px; }
.chart .bar-lbl {
  position: absolute; top: -18px; left: -4px; right: -4px; text-align: center;
  font-family: var(--display); font-size: 12px; font-weight: 600; color: var(--muted);
}
.chart-x { display: flex; gap: 5px; margin-bottom: 4px; }
.chart-x div { flex: 1; text-align: center; font-size: 9px; letter-spacing: .04em; color: var(--dim); }

/* ---------- пустые состояния ---------- */
.empty { text-align: center; padding: 48px 24px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.empty .eic {
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; color: var(--dim);
}
.empty b { color: var(--text); }

/* ---------- финальный экран ---------- */
.finish { text-align: center; padding-top: 48px; }
.finish .fic {
  width: 88px; height: 88px; margin: 0 auto 20px; border-radius: 50%;
  background: rgba(201,247,63,.1); border: 1px solid rgba(201,247,63,.35);
  display: flex; align-items: center; justify-content: center; color: var(--accent);
}
.finish h2 { font-family: var(--display); font-size: 34px; font-weight: 700; text-transform: uppercase; line-height: .95; margin: 0 0 8px; }
.finish .sub { color: var(--muted); font-size: 14px; }
.finish .next { margin: 22px auto 0; max-width: 340px; }
.finish .next .row { text-align: left; }
.finish .btn { max-width: 340px; margin: 24px auto 0; }

/* ---------- таббар ---------- */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; background: rgba(11,13,16,.9); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px);
}
.tab {
  flex: 1; min-height: 52px; background: none; border: none; border-radius: var(--r-sm);
  color: var(--dim); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  transition: color var(--t-fast);
}
.tab svg { width: 21px; height: 21px; }
.tab:hover { color: var(--muted); }
.tab.active { color: var(--accent); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 104px; transform: translateX(-50%) translateY(16px);
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--text);
  font-weight: 600; font-size: 13.5px; padding: 12px 18px; border-radius: 999px;
  opacity: 0; transition: opacity var(--t-med), transform var(--t-med);
  z-index: 40; pointer-events: none; box-shadow: 0 12px 32px rgba(0,0,0,.5);
}
.toast .ic { color: var(--ok); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.loading { text-align: center; color: var(--dim); padding: 48px 0; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; }

/* ---------- календарь ---------- */
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-head .m {
  font-family: var(--display); font-size: 21px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .03em;
}
.cal-nav {
  width: 44px; height: 44px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: border-color var(--t-fast);
}
.cal-nav:hover { border-color: var(--line-strong); }
.cal-nav:disabled { opacity: .35; cursor: default; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow {
  text-align: center; font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--dim); padding: 6px 0 8px;
}
.cal-day {
  position: relative; aspect-ratio: 1; min-height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 1px solid transparent; border-radius: 10px;
  color: var(--muted); font-family: var(--display); font-size: 16px; font-weight: 600;
  cursor: default; transition: border-color var(--t-fast), background var(--t-fast);
}
.cal-day.blank { visibility: hidden; }
.cal-day.today { border-color: var(--line-strong); color: var(--text); }
.cal-day.on {
  background: rgba(201,247,63,.12); border-color: rgba(201,247,63,.35);
  color: var(--accent); cursor: pointer;
}
.cal-day.on:hover { background: rgba(201,247,63,.2); }
.cal-day.on::after {
  content: ""; position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent);
}
.cal-legend { display: flex; gap: 16px; margin-top: 12px; padding: 0 2px; }
.cal-legend span { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--dim); }
.cal-legend i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* просмотр дня */
.dayview-ex { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; margin-bottom: 10px; }
.dayview-ex .nm { font-weight: 600; font-size: 15px; }
.dayview-ex .st { font-family: var(--display); font-size: 16px; font-weight: 600; letter-spacing: .04em; color: var(--accent); margin-top: 4px; }
