/* Шрифты лежат рядом, без внешних запросов */
@font-face { font-family: "Unbounded"; src: url("fonts/unbounded-cyrillic-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Unbounded"; src: url("fonts/unbounded-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; unicode-range: U+0000-00FF, U+2013-2014, U+2018-201D, U+2212; }
@font-face { font-family: "Unbounded"; src: url("fonts/unbounded-cyrillic-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Unbounded"; src: url("fonts/unbounded-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0000-00FF, U+2013-2014, U+2018-201D, U+2212; }
@font-face { font-family: "Onest"; src: url("fonts/onest-cyrillic-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; src: url("fonts/onest-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+2013-2014, U+2018-201D, U+2212; }
@font-face { font-family: "Onest"; src: url("fonts/onest-cyrillic-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; src: url("fonts/onest-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0000-00FF, U+2013-2014, U+2018-201D, U+2212; }

:root {
  --void: #070a12;      /* фон */
  --hull: #0f1524;      /* панели */
  --hull2: #172038;     /* приподнятые элементы */
  --rail: #26314f;      /* линии */
  --ice: #e8f1ff;       /* текст */
  --mute: #8794b5;      /* вторичный текст */
  --plasma: #4de8ff;    /* действие, отдых */
  --ember: #ff5a36;     /* усилие, работающие мышцы */
  --cut: 12px;
  --display: "Unbounded", "Onest", system-ui, sans-serif;
  --body: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --z-bottom: 5; --z-timer: 10;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--void); color: var(--ice); }
body {
  font: 400 16px/1.45 var(--body);
  min-height: 100dvh;
  background:
    linear-gradient(rgba(77,232,255,.035) 1px, transparent 1px) 0 0 / 100% 32px,
    radial-gradient(120% 60% at 100% 0%, rgba(77,232,255,.10), transparent 60%),
    var(--void);
  background-attachment: fixed;
}
main { max-width: 560px; margin: 0 auto; padding: 14px 16px calc(112px + var(--safe-b)); }
h1 { font: 700 26px/1.1 var(--display); margin: 10px 0 6px; letter-spacing: -.01em; text-wrap: balance; }
h2 { font: 500 19px/1.2 var(--display); margin: 0 0 6px; }
p { margin: 0; }
.muted { color: var(--mute); font-size: 14px; }

/* срезанный угол: панели и кнопки; поля ввода прямоугольные с радиусом 4px */
.cut { clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut)); }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
.topbar .meta { display: flex; gap: 14px; align-items: baseline; color: var(--mute); font-size: 14px; }
.topbar .meta b { color: var(--ice); font: 500 14px var(--display); }
.icon-btn {
  min-width: 44px; height: 44px; border: 0; background: var(--hull2); color: var(--ice);
  font: 600 14px var(--body); padding: 0 12px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  --cut: 8px; transition: transform .15s var(--ease-out);
}
.icon-btn:active { transform: scale(.95); }
.icon-btn svg, .btn svg { width: 18px; height: 18px; fill: currentColor; flex: none; }

.card { background: var(--hull); padding: 16px; margin-top: 12px; position: relative; }
.card.tap { cursor: pointer; transition: transform .15s var(--ease-out); }
.card.tap:active { transform: scale(.98); }
.workout-card { padding: 18px 16px 16px; border-left: 3px solid var(--plasma); }
.workout-card .go { position: absolute; right: 16px; top: 18px; color: var(--plasma); }
.workout-card .go svg { width: 22px; height: 22px; fill: currentColor; }
.facts { display: flex; gap: 18px; margin-top: 14px; }
.facts div { font-size: 13px; color: var(--mute); }
.facts b { display: block; font: 500 17px var(--display); color: var(--ice); white-space: nowrap; }
.rule { border-left: 3px solid var(--ember); background: rgba(255,90,54,.10); color: #ffc2b2; padding: 10px 12px; font-size: 14px; margin-top: 12px; }

.btn {
  border: 0; min-height: 52px; padding: 0 18px; font: 600 16px var(--body); cursor: pointer;
  color: var(--ice); background: var(--hull2); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .15s var(--ease-out), background-color .15s var(--ease-out);
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--plasma); color: #04222a; }
.btn.work { background: var(--ember); color: #2a0a02; }
.btn.ghost { background: var(--hull2); color: var(--ice); }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .35; }
:focus-visible { outline: 2px solid var(--plasma); outline-offset: 2px; }

.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-bottom); padding: 14px 16px calc(12px + var(--safe-b));
  background: linear-gradient(to top, var(--void) 68%, rgba(7,10,18,0));
}
.bottom-inner { max-width: 560px; margin: 0 auto; display: flex; gap: 10px; }
.bottom-inner .btn { flex: 1; min-width: 0; }
.bottom-inner .btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.list-row + .list-row { border-top: 1px solid var(--rail); }
.thumb { width: 84px; height: 64px; object-fit: cover; background: var(--hull); flex: none; --cut: 8px; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; }
.row-target { font: 500 14px var(--display); color: var(--plasma); white-space: nowrap; }
.group-title { color: var(--plasma); font-size: 14px; font-weight: 600; margin: 20px 0 0; }

/* сегменты прогресса: один сегмент на шаг тренировки */
.segs { display: flex; gap: 3px; margin-top: 10px; }
.segs i { flex: 1; height: 5px; background: var(--rail); transform: skewX(-24deg); transition: background-color .3s var(--ease-out); }
.segs i.done { background: var(--plasma); }
.segs i.now { background: var(--ice); }

.media { margin: 12px -16px 0; background: var(--hull); position: relative; }
.media img { display: block; width: 100%; height: auto; aspect-ratio: 380/290; }
.media svg.fig { aspect-ratio: 760/580; }
svg.fig.thumb { width: 84px; height: 64px; }
.hud { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 14px; }
.hud .big { font: 700 32px/1 var(--display); letter-spacing: -.02em; }
.hud .side { display: flex; gap: 16px; text-align: right; font-size: 13px; color: var(--mute); }
.hud .side b { display: block; font: 500 15px var(--display); color: var(--ice); white-space: nowrap; }
.muscles { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; color: #ffc2b2; }
.muscles::before { content: ""; width: 10px; height: 10px; background: var(--ember); transform: rotate(45deg); flex: none; }
.cues { margin: 12px 0 0; padding: 0; list-style: none; font-size: 15px; }
.cues li { padding: 6px 0 6px 14px; border-left: 2px solid var(--rail); color: #c9d4ee; }

.set { display: grid; grid-template-columns: 30px 1fr 1fr 56px; gap: 10px; align-items: end; padding: 10px 0; }
.set + .set { border-top: 1px solid var(--rail); }
.set.no-weight { grid-template-columns: 30px 1fr 56px; }
.set-n { font: 700 20px var(--display); color: var(--mute); align-self: center; padding-top: 14px; }
.set.done .set-n { color: var(--plasma); }
.field { display: flex; flex-direction: column; gap: 3px; }
.field label { font-size: 12px; color: var(--mute); }
.field input {
  width: 100%; height: 48px; border-radius: 4px; border: 1px solid var(--rail); background: var(--void);
  color: var(--ice); font: 500 18px var(--display); padding: 0 10px;
}
.field input::placeholder { color: #55628a; }
.field input:focus { outline: 2px solid var(--plasma); outline-offset: 0; border-color: transparent; }
.check {
  width: 56px; height: 48px; border: 0; background: var(--hull2); color: var(--mute); cursor: pointer;
  display: grid; place-items: center; --cut: 8px; transition: transform .15s var(--ease-out), background-color .15s var(--ease-out);
}
.check svg { width: 22px; height: 22px; fill: currentColor; }
.check:active { transform: scale(.94); }
.set.done .check { background: var(--plasma); color: #04222a; }
.prev { font-size: 13px; color: var(--mute); margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--rail); }
.items { margin: 0; padding: 0; list-style: none; }
.items li { padding: 9px 0 9px 14px; border-left: 2px solid var(--rail); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.stat { background: var(--hull); padding: 14px 10px; }
.stat b { display: block; font: 700 19px var(--display); color: var(--plasma); white-space: nowrap; }
.stat span { font-size: 12px; color: var(--mute); }
.hist-row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; font-size: 15px; }
.hist-row + .hist-row { border-top: 1px solid var(--rail); }
.hist-row .val { color: var(--mute); text-align: right; font-variant-numeric: tabular-nums; }
.empty { color: var(--mute); font-size: 15px; padding: 6px 0; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; }
.setting + .setting { border-top: 1px solid var(--rail); }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper b { min-width: 64px; text-align: center; font: 500 15px var(--display); }
.toggle { width: 56px; height: 32px; background: var(--hull2); border: 0; position: relative; cursor: pointer; --cut: 6px; }
.toggle::after { content: ""; position: absolute; top: 5px; left: 5px; width: 22px; height: 22px; background: var(--mute); transition: transform .15s var(--ease-out), background-color .15s; }
.toggle[aria-pressed="true"]::after { transform: translateX(24px); background: var(--plasma); }

/* таймер: кольцо на 60 делений */
.timer { position: fixed; inset: 0; z-index: var(--z-timer); background: rgba(5,7,13,.96); display: grid; place-items: center; padding: 20px; }
.timer[hidden] { display: none; }
.timer-card { width: 100%; max-width: 360px; text-align: center; animation: pop .2s var(--ease-out) both; }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
.timer-label { font: 500 18px var(--display); color: var(--plasma); }
.timer.work .timer-label { color: var(--ember); }
.ring { position: relative; width: min(78vw, 300px); aspect-ratio: 1; margin: 18px auto; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--rail); stroke-width: 9; stroke-dasharray: 3.2 2.2455; }
.ring-fg { fill: none; stroke: var(--plasma); stroke-width: 9; stroke-dasharray: 3.2 2.2455; }
.ring-mask { fill: none; stroke: #fff; stroke-width: 12; stroke-dasharray: 326.73; transition: stroke-dashoffset .25s linear; }
.ring-in { fill: none; stroke: var(--rail); stroke-width: 1; }
.timer.work .ring-fg { stroke: var(--ember); }
.timer-time { position: absolute; inset: 0; display: grid; place-items: center; font: 700 56px var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.timer-next { color: var(--mute); min-height: 22px; font-size: 15px; }
.timer-actions { display: flex; gap: 10px; margin: 16px 0 10px; }
.timer-actions[hidden] { display: none; }
.timer-actions .btn { flex: 1; }
.timer.work #timerSkip { margin-top: 16px; }

@media (hover: hover) and (pointer: fine) {
  .btn.primary:hover { background: #7df0ff; }
  .card.tap:hover { background: var(--hull2); }
  .icon-btn:hover, .btn.ghost:hover { background: #1e2a48; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- вход и аккаунт (auth.js) ---------- */
.auth { min-height: calc(100dvh - 150px); display: flex; flex-direction: column; justify-content: center; gap: 12px; padding-top: 24px; }
.auth-head h1 { font-size: 30px; margin: 0 0 8px; }
.auth .card { margin-top: 0; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form .field input { height: 52px; font: 500 17px var(--body); }
.auth-form .btn { margin-top: 4px; }
.auth-or { text-align: center; color: var(--mute); font-size: 13px; }
.auth-error { font-size: 14px; color: #ffc2b2; border-left: 3px solid var(--ember); background: rgba(255,90,54,.10); padding: 8px 10px; }
.auth-error[hidden] { display: none; }
.auth-link { align-self: center; min-height: 44px; padding: 0 12px; border: 0; background: none; color: var(--plasma); font: 600 15px var(--body); cursor: pointer; }
.auth button[disabled] { opacity: .5; cursor: default; }
.auth-splash { padding-top: 40px; text-align: center; }
.auth-row { display: flex; gap: 10px; margin-top: 12px; }
.auth-row .btn { flex: 1; min-width: 0; }
.auth-msg { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--rail); font-size: 14px; color: var(--plasma); }
.auth-msg.bad { color: #ffc2b2; }
.btn svg.ico-line { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 18; stroke-linecap: round; stroke-linejoin: round; }

/* история: что ещё не ушло на сервер, прогресс по упражнениям */
.sync-note { margin-top: 12px; padding: 10px 12px; border-left: 3px solid var(--plasma); background: rgba(77,232,255,.08); font-size: 14px; }
.prog { padding: 11px 0; }
.prog:first-child { padding-top: 0; }
.prog:last-child { padding-bottom: 0; }
.prog + .prog { border-top: 1px solid var(--rail); }
.prog-row { display: flex; justify-content: space-between; gap: 12px; padding-top: 4px; font-size: 14px; }
.prog-row .val { text-align: right; font-variant-numeric: tabular-nums; }
