/* Дневник тренировок. Шрифт — Onest (Light 300 / Regular 400 / Medium 500, настоящие файлы),
   одна акцентная краска, без разрядки и капса — как в PDF программы.
   Делается под iPhone 13 (390 px, Safari): поля ввода не меньше 16 px — иначе iOS увеличивает страницу,
   нижнее меню учитывает полоску «домой» (safe-area), кнопки не меньше 44 px. */

@font-face { font-family: "Onest"; font-weight: 300; font-style: normal; font-display: swap; src: url("fonts/Onest-Light.woff2") format("woff2"); }
@font-face { font-family: "Onest"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/Onest-Regular.woff2") format("woff2"); }
@font-face { font-family: "Onest"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/Onest-Medium.woff2") format("woff2"); }

:root {
  --bg: #ffffff;
  --ink: #17191c;
  --muted: #5b626d;
  --faint: #8d939c;
  --rule: #e1e4e8;
  --field: #c9ced6;
  --soft: #f2f4f7;
  --accent: #1c5aa6;
  --err: #a8321f;
  --tabs: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Onest"; font-weight: 400; font-size: 17px; line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
input, button, select, textarea { font-family: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
p { margin: 0 0 8px; }
small { font-size: 14px; }
h1, h2, h3 { font-weight: 500; margin: 0; }
h1 { font-size: 28px; line-height: 1.15; }
h2 { font-size: 21px; line-height: 1.2; margin-bottom: 10px; }
h3 { font-size: 17px; line-height: 1.3; }

.wrap {
  max-width: 40rem; margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px calc(var(--tabs) + var(--safe-b) + 32px);
}
.page-head { margin-bottom: 18px; }
.back { margin: 0 0 6px; font-size: 15px; }
.back a { display: inline-block; padding: 6px 0; }
.lead { font-size: 19px; line-height: 1.35; margin: 4px 0 10px; }
.meta { color: var(--muted); font-size: 15px; margin: 4px 0 0; }
.note { color: var(--muted); font-size: 15px; margin-top: 10px; }
.hint { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
.muted { color: var(--faint); }
.ok { color: var(--accent); }
.err { color: var(--err); }
.num { font-weight: 300; color: var(--accent); font-variant-numeric: tabular-nums; }
.sec { margin-top: 28px; }
.more { display: inline-block; margin-top: 12px; padding: 6px 0; font-size: 16px; }
.credit { margin-top: 32px; color: var(--faint); font-size: 13px; }

/* Кнопки и поля */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 20px; border: 1px solid var(--accent); border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 17px; font-weight: 500; cursor: pointer;
  text-align: center; line-height: 1.2;
}
.btn.ghost { background: transparent; color: var(--accent); }
.btn.wide { display: flex; width: 100%; margin-top: 12px; }
.btn:active { opacity: .8; }
.link { background: none; border: 0; padding: 10px 0; min-height: 44px; color: var(--accent); font-size: 16px; cursor: pointer; }

input, textarea, select {
  width: 100%; font-size: 17px; border: 1px solid var(--field); border-radius: 8px; background: #fff;
  padding: 10px 12px; min-height: 46px; -webkit-appearance: none; appearance: none;
}
textarea { resize: vertical; line-height: 1.4; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input[type="date"] { display: block; min-width: 0; }
input::placeholder, textarea::placeholder { color: #a6acb5; }
.fld { display: block; margin-top: 14px; font-size: 15px; color: var(--muted); }
.fld small { display: block; color: var(--faint); }
.fld input, .fld textarea { margin-top: 6px; color: var(--ink); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
form > .btn { margin-top: 16px; }

/* Переключатели: самочувствие, хоккей, тяжесть */
.seg { border: 0; padding: 0; margin: 16px 0 0; }
.seg legend { padding: 0; font-size: 15px; color: var(--muted); margin-bottom: 6px; }
.seg label { display: inline-block; margin: 0 6px 6px 0; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; pointer-events: none; }
.seg span {
  display: inline-flex; align-items: center; justify-content: center; min-width: 48px; min-height: 44px;
  padding: 0 14px; border: 1px solid var(--field); border-radius: 10px; font-size: 17px; cursor: pointer;
}
.seg input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg.ten { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.seg.ten legend, .seg.ten .hint { grid-column: 1 / -1; }
.seg.ten label { margin: 0; }
.seg.ten span { width: 100%; min-width: 0; padding: 0; }

/* Списки строк */
.rows .row, a.row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--rule); color: var(--ink);
}
.rows .row:first-child { border-top: 1px solid var(--rule); }
.row small { display: block; color: var(--muted); font-size: 14px; }
.row .r { text-align: right; white-space: nowrap; flex-shrink: 0; }
.row .r small { display: inline; margin-left: 4px; }
.row .r small.up { color: var(--accent); }
.row.sch { justify-content: flex-start; }
.row.sch .wd { width: 36px; color: var(--muted); flex-shrink: 0; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { position: relative; padding: 7px 0 7px 16px; }
ul.plain li::before { content: "–"; position: absolute; left: 0; color: var(--faint); }

/* Сегодня */
.strip { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.cell { display: flex; flex-direction: column; align-items: center; padding: 8px 0 10px; min-height: 64px; }
.cell .wd { font-size: 13px; color: var(--muted); }
.cell .mk { font-size: 20px; font-weight: 300; color: var(--accent); line-height: 1.25; }
.cell .mk.hk { font-size: 11px; font-weight: 400; color: var(--ink); line-height: 1.6; }
.cell .mk.empty { color: var(--rule); }
.cell.now { background: var(--soft); }
.cell.now .wd { color: var(--ink); font-weight: 500; }

.days { border-top: 1px solid var(--rule); }
.dayrow {
  display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; width: 100%;
  padding: 12px 0; min-height: 64px; border: 0; border-bottom: 1px solid var(--rule); background: none;
  text-align: left; cursor: pointer; font-size: 17px;
}
.dayrow .dl { font-size: 28px; font-weight: 300; color: var(--accent); line-height: 1; }
.dayrow .dt { font-weight: 500; line-height: 1.3; }
.dayrow .dt small { display: block; font-weight: 400; color: var(--muted); }
.dayrow .go { color: var(--accent); font-size: 16px; }
.dayrow.sched { background: var(--soft); padding-left: 8px; padding-right: 8px; }
.foot { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 32px; font-size: 15px; }
.foot a { color: var(--muted); padding: 8px 0; }

/* Тренировка */
.warm summary, .how summary {
  cursor: pointer; color: var(--accent); font-size: 16px; padding: 10px 0; min-height: 44px; list-style: none;
}
.warm summary { font-size: 19px; font-weight: 500; color: var(--ink); }
.warm summary::after, .how summary::after { content: " →"; color: var(--accent); }
.warm[open] summary::after, .how[open] summary::after { content: " ↓"; }
summary::-webkit-details-marker { display: none; }

.block h2 { margin-bottom: 0; }
.ex { padding: 16px 0 6px; border-bottom: 1px solid var(--rule); }
.ex-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ex-h h3 { font-size: 18px; }
.dose { font-weight: 300; font-size: 18px; color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dose small { font-weight: 400; font-size: 13px; color: var(--muted); }
.prev { color: var(--muted); font-size: 15px; margin: 4px 0 0; }
.cue { color: var(--muted); font-size: 15px; margin: 8px 0 4px; }
.how .cue { margin-bottom: 8px; }

.sets { margin-top: 8px; }
.set-head, .set { display: grid; grid-template-columns: 26px repeat(var(--n, 1), minmax(0, 1fr)) 48px; gap: 8px; align-items: center; }
.sets.c2 { --n: 2; }
.set-head { font-size: 13px; color: var(--muted); padding-bottom: 2px; }
.set-head span { text-align: center; }
.set-head span:first-child { text-align: left; }
.set { padding: 4px 0; }
.set .n { color: var(--faint); font-size: 15px; }
.set input { text-align: center; font-size: 18px; padding: 8px 4px; min-height: 46px; font-variant-numeric: tabular-nums; }
.tick {
  width: 48px; height: 46px; border: 1.5px solid var(--field); border-radius: 10px; background: #fff; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--field); padding: 0;
}
.tick::after { content: "✓"; }
.set.done .tick { background: var(--accent); border-color: var(--accent); color: #fff; }
.set.done input { border-color: transparent; background: var(--soft); }
.set.rec .n { color: var(--accent); font-weight: 500; }
.set.err input { border-color: var(--err); }
.set-tools { display: flex; align-items: center; gap: 20px; min-height: 44px; }
.recnote { margin-left: auto; color: var(--accent); font-size: 15px; }
.done-box h3 { margin-top: 18px; margin-bottom: 4px; }
.danger { margin-top: 18px; }
.danger .link { color: var(--err); }

/* Анимация: два кадра сменяют друг друга */
.anim { position: relative; margin: 8px 0; aspect-ratio: 3 / 2; background: var(--soft); border-radius: 8px; overflow: hidden; }
.anim img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.anim img.b { animation: swap 1.8s infinite; }
@keyframes swap { 0%, 49.9% { opacity: 0; } 50%, 100% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .anim img.b { animation-duration: 4s; } }
.anim.small { width: 96px; flex-shrink: 0; margin: 0; border-radius: 6px; }
.stations { list-style: none; padding: 0; margin: 10px 0 0; }
.stations li { display: flex; align-items: center; gap: 12px; padding: 6px 0; }

/* Все упражнения */
.jump { display: flex; flex-wrap: wrap; gap: 2px 18px; margin: 8px 0 0; font-size: 16px; }
.jump a { padding: 8px 0; }
.dayview > h2 { margin-bottom: 0; }
.dayview h3 { margin-top: 22px; color: var(--muted); font-weight: 400; font-size: 16px; }
.today-tag { color: var(--accent); font-weight: 500; }
.exv { padding: 12px 0 14px; border-bottom: 1px solid var(--rule); }
.exv-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 6px; }
.exv-h b { font-weight: 500; font-size: 18px; }

/* Программа */
.rule { display: grid; grid-template-columns: 30px 1fr; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.rule .n { font-size: 22px; font-weight: 300; color: var(--accent); line-height: 1.1; }
.rule b { font-weight: 500; display: block; }
.rule p { color: var(--muted); font-size: 15px; margin: 2px 0 0; }
.step { display: grid; grid-template-columns: 52px 1fr; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.step .w { font-size: 22px; font-weight: 300; color: var(--faint); line-height: 1.1; }
.step.cur .w { color: var(--accent); }
.step.cur p:first-child { font-weight: 500; }
.step p { margin: 0; }

/* Дневник и история */
.daynav { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; margin-bottom: 14px; }
.daynav a { display: flex; align-items: center; justify-content: center; height: 46px; font-size: 22px; }
.entry { display: grid; grid-template-columns: 96px 1fr; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--rule); color: var(--ink); }
.entry .ed { color: var(--muted); }
.entry small { display: block; color: var(--muted); }
.entry small.warn { color: var(--err); }

/* Прогресс */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 16px; }
.kpis div { display: flex; flex-direction: column; }
.kpis .big { font-size: 40px; font-weight: 300; color: var(--accent); line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpis div span:last-child { font-size: 14px; color: var(--muted); }
.exrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--rule); color: var(--ink); }
.exn small { display: block; color: var(--muted); }
.spark { width: 96px; height: 28px; flex-shrink: 0; }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.6; }
.chart { display: block; width: 100%; height: auto; margin-top: 6px; }
.ch-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.ch-dot { fill: #fff; stroke: var(--accent); stroke-width: 1.6; }
.ch-dot.best { fill: var(--accent); }
.ch-base { stroke: var(--rule); }
.ch-val { font-size: 13px; fill: var(--ink); }
.ch-lbl { font-size: 11px; fill: var(--muted); }

/* Нижнее меню */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(255, 255, 255, .97); border-top: 1px solid var(--rule);
  padding-bottom: var(--safe-b);
}
.tabs a { display: flex; align-items: center; justify-content: center; height: var(--tabs); font-size: 15px; color: var(--muted); }
.tabs a[aria-current="page"] { color: var(--accent); font-weight: 500; }

/* Таймер отдыха */
.rest {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tabs) + var(--safe-b)); z-index: 25;
  display: flex; align-items: center; gap: 16px; padding: 8px 16px; background: var(--ink); color: #fff;
}
.rest[hidden] { display: none; }
.rest-l { font-size: 15px; color: #c5c9cf; }
.rest-t { font-size: 28px; font-weight: 300; font-variant-numeric: tabular-nums; margin-right: auto; }
.rest .link { color: #fff; }
body.resting .wrap { padding-bottom: calc(var(--tabs) + var(--safe-b) + 96px); }

/* Таймер интервалов и круга — на весь экран */
.tmr {
  position: fixed; inset: 0; z-index: 100; background: #fff;
  display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
  padding: calc(20px + env(safe-area-inset-top, 0px)) 20px calc(20px + var(--safe-b));
  min-height: 100vh; min-height: 100dvh;
}
.tmr[hidden] { display: none; }
.tmr-round { color: var(--muted); font-size: 17px; margin: 0; }
.tmr-phase { font-size: 26px; font-weight: 500; line-height: 1.2; margin: 14px 0 0; }
.tmr-time { font-size: 104px; font-weight: 300; line-height: 1; margin: 18px 0; font-variant-numeric: tabular-nums; color: var(--accent); }
.tmr.rest-phase .tmr-time { color: var(--ink); }
.tmr-next { color: var(--muted); font-size: 17px; min-height: 1.5em; }
.tmr-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; max-width: 360px; margin-top: 28px; }

/* Вход */
.pin { display: flex; align-items: center; min-height: 80vh; min-height: 80dvh; }
.pin form { width: 100%; max-width: 320px; margin: 0 auto; }
.pin h1 { margin-bottom: 24px; }
.pin label { color: var(--muted); font-size: 15px; }
.pin input { margin-top: 6px; font-size: 28px; text-align: center; }
.pin .btn { width: 100%; margin-top: 16px; }
.pin .err { margin-top: 10px; }
