/* ===== Liquid Glass по правилам Apple (WWDC25) =====
   Два слоя:
   • контент (карточки, списки, поля) — спокойная непрозрачная поверхность .surface, цвет живёт здесь;
   • управление (таб-бар, плашка тренировки, таймер, шторки, тосты, «Назад») — стекло .liquid,
     которое плавает над контентом. Стекло на стекле не кладём: внутри .liquid только заливки.
   Скругления концентрические: внутренний радиус = внешний − отступ. */
:root {
  --bg: #f2f2f7;
  --blob-1: #7aa7ff;
  --blob-2: #ff9ec7;
  --blob-3: #8ef0d0;
  --text: #0b0b0f;
  --text-2: rgba(60, 60, 67, 0.72);
  --text-3: rgba(60, 60, 67, 0.5);
  /* контентный слой */
  --surface: rgba(255, 255, 255, 0.86);
  --surface-line: rgba(0, 0, 0, 0.05);
  --surface-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  /* стекло (regular) */
  --glass: rgba(255, 255, 255, 0.5);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --glass-blur: blur(12px) saturate(190%) brightness(1.08);
  --glass-rim: rgba(255, 255, 255, 0.95);
  --glass-rim-low: rgba(0, 0, 0, 0.07);
  --glass-shadow: 0 8px 30px rgba(0, 0, 0, 0.14), 0 1px 4px rgba(0, 0, 0, 0.1);
  --dim: rgba(0, 0, 0, 0.18);
  --fill: rgba(120, 120, 128, 0.12);
  --fill-2: rgba(120, 120, 128, 0.2);
  --accent: #0a84ff;
  --accent-text: #ffffff;
  --green: #30c85e;
  --red: #ff3b30;
  --orange: #ff9500;
  --radius-xl: 34px;
  --radius-l: 26px;
  --radius-m: 14px;
  --blur: var(--glass-blur);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Inter, system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --blob-1: #1f4fd6;
    --blob-2: #9b2a6b;
    --blob-3: #0d7d68;
    --text: #f5f5f7;
    --text-2: rgba(235, 235, 245, 0.66);
    --text-3: rgba(235, 235, 245, 0.45);
    --surface: rgba(28, 28, 30, 0.88);
    --surface-line: rgba(255, 255, 255, 0.06);
    --surface-shadow: none;
    --glass: rgba(40, 40, 46, 0.42);
    --glass-strong: rgba(44, 44, 50, 0.82);
    --glass-blur: blur(12px) saturate(170%) brightness(0.92);
    --glass-rim: rgba(255, 255, 255, 0.32);
    --glass-rim-low: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 10px 32px rgba(0, 0, 0, 0.55), 0 1px 4px rgba(0, 0, 0, 0.4);
    --dim: rgba(0, 0, 0, 0.45);
    --fill: rgba(120, 120, 128, 0.24);
    --fill-2: rgba(120, 120, 128, 0.36);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000; --blob-1: #1f4fd6; --blob-2: #9b2a6b; --blob-3: #0d7d68;
  --text: #f5f5f7; --text-2: rgba(235,235,245,.66); --text-3: rgba(235,235,245,.45);
  --surface: rgba(28,28,30,.88); --surface-line: rgba(255,255,255,.06); --surface-shadow: none;
  --glass: rgba(40,40,46,.42); --glass-strong: rgba(44,44,50,.82);
  --glass-blur: blur(12px) saturate(170%) brightness(.92);
  --glass-rim: rgba(255,255,255,.32); --glass-rim-low: rgba(255,255,255,.08);
  --glass-shadow: 0 10px 32px rgba(0,0,0,.55), 0 1px 4px rgba(0,0,0,.4);
  --dim: rgba(0,0,0,.45);
  --fill: rgba(120,120,128,.24); --fill-2: rgba(120,120,128,.36);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
  overflow-x: hidden;
}

/* Цвет — в контентном слое: мягкие пятна за карточками. Стеклу нужно, что преломлять. */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.backdrop i {
  position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.4;
  animation: drift 26s ease-in-out infinite alternate;
}
.backdrop i:nth-child(1) { width: 55vmax; height: 55vmax; background: var(--blob-1); top: -18vmax; left: -14vmax; }
.backdrop i:nth-child(2) { width: 45vmax; height: 45vmax; background: var(--blob-2); bottom: -16vmax; right: -12vmax; animation-delay: -8s; }
.backdrop i:nth-child(3) { width: 35vmax; height: 35vmax; background: var(--blob-3); top: 40%; left: 45%; animation-delay: -15s; opacity: .3; }
@keyframes drift { to { transform: translate(6vmax, 4vmax) scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .backdrop i { animation: none; } }

/* ===== Контентный слой ===== */
.surface {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-l);
  box-shadow: var(--surface-shadow), inset 0 0 0 0.5px var(--surface-line);
}

/* ===== Liquid Glass (regular) — только для плавающих элементов управления =====
   Линза: размытие слабее, чем у старых «матовых» материалов, зато сильнее насыщенность и яркость;
   по краю — светлый ободок (свет концентрируется у кромки), сверху — блик. */
.liquid {
  position: relative;
  isolation: isolate;
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow),
    inset 0 1px 0.5px var(--glass-rim),
    inset 0 -1px 1px var(--glass-rim-low),
    inset 0 0 0 0.5px var(--glass-rim-low);
}
/* Кромка-линза: яркий ободок сверху-слева, слабее снизу-справа */
.liquid::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  padding: 1px;
  background: linear-gradient(140deg, var(--glass-rim) 0%, transparent 35%, transparent 65%, var(--glass-rim-low) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
/* Блик-подсветка в верхней части */
.liquid::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background: radial-gradient(120% 70% at 30% 0%, rgba(255,255,255,.28), transparent 60%);
  mix-blend-mode: soft-light;
}

/* Мягкий край прокрутки: контент растворяется под статус-баром, а не режется */
body::before {
  content: ""; position: fixed; left: 0; right: 0; top: 0; z-index: 35; pointer-events: none;
  height: calc(env(safe-area-inset-top) + 28px);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  background: linear-gradient(var(--bg), transparent);
  -webkit-mask-image: linear-gradient(#000 40%, transparent); mask-image: linear-gradient(#000 40%, transparent);
}

/* Доступность: «Понижение прозрачности» и «Увеличение контраста» */
@media (prefers-reduced-transparency: reduce) {
  .liquid { background: var(--glass-strong); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .liquid::after { display: none; }
  .backdrop { display: none; }
}
@media (prefers-contrast: more) {
  .liquid { background: var(--glass-strong); box-shadow: inset 0 0 0 1.5px var(--text); }
  .surface { box-shadow: inset 0 0 0 1px var(--text-3); }
}

/* ===== Каркас ===== */
#app {
  max-width: 640px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 110px);
}
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 18px 4px 18px; }
.topbar h1 { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; margin: 0; line-height: 1.05; }
.topbar .sub { color: var(--text-2); font-size: 15px; margin-top: 4px; }
.back { display: inline-flex; align-items: center; gap: 2px; color: var(--text); font-size: 17px; font-weight: 600; text-decoration: none;
  margin: 4px 0 -4px 0; border: 0; padding: 0 16px 0 12px; min-height: 44px; border-radius: 999px; font-family: inherit; cursor: pointer;
  position: relative; isolation: isolate; background: var(--glass); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow), inset 0 1px 0.5px var(--glass-rim), inset 0 0 0 0.5px var(--glass-rim-low); }
.back:active { transform: scale(0.96); filter: brightness(1.1); }

.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); margin: 26px 18px 8px; font-weight: 600; }
.card { padding: 16px; margin-bottom: 12px; }
.card h2 { font-size: 20px; margin: 0 0 4px; letter-spacing: -0.02em; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }

/* Список в стиле iOS inset grouped */
.list { padding: 4px 0; overflow: hidden; }
.list .item {
  display: flex; align-items: center; gap: 12px; padding: 13px 18px; color: inherit; text-decoration: none;
  position: relative; cursor: pointer;
}
.list .item + .item::before {
  content: ""; position: absolute; top: 0; left: 18px; right: 0; height: 0.5px; background: var(--fill-2);
}
.list .item:active { background: var(--fill); }
.chev { color: var(--text-3); font-size: 20px; }

/* ===== Кнопки ===== */
.btn {
  appearance: none; border: 0; cursor: pointer; font-family: inherit;
  font-size: 17px; font-weight: 600; padding: 14px 20px; border-radius: 999px;
  background: var(--fill); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .15s ease, background .2s, opacity .2s;
}
.btn:active { transform: scale(0.96); }
/* Тонируем только главное действие экрана: цветное стекло с бликом по кромке */
.btn.primary {
  background: color-mix(in srgb, var(--accent) 88%, transparent);
  color: var(--accent-text);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 30%, transparent),
    inset 0 1px 0.5px rgba(255,255,255,.55), inset 0 -1px 1px rgba(0,0,0,.12);
}
.btn:active { filter: brightness(1.08); }
.btn.danger { color: var(--red); }
.btn.block { width: 100%; }
.btn.sm { font-size: 15px; padding: 9px 14px; }
.btn.ghost { background: transparent; color: var(--accent); padding-left: 8px; padding-right: 8px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ===== Поля ===== */
input, select, textarea {
  font-family: inherit; font-size: 17px; color: var(--text);
  background: var(--fill); border: 1px solid transparent; border-radius: 12px;
  padding: 11px 14px; width: 100%; outline: none; transition: border .2s, background .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); background: var(--surface); }
textarea { min-height: 90px; resize: vertical; }
label.field { display: block; }
label.field span { display: block; font-size: 13px; color: var(--text-2); margin: 0 4px 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* ===== Сегменты/чипы ===== */
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--fill); color: var(--text-2); }
.chip.accent { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.chip.green { background: color-mix(in srgb, var(--green) 20%, transparent); color: var(--green); }

/* ===== Статы ===== */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { padding: 14px; text-align: left; }
.stat b { display: block; font-size: 26px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--text-2); }

/* ===== Тренировка ===== */
.ex-card { padding: 14px 12px 12px; margin-bottom: 12px; }
.ex-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 0 4px 10px; }
.ex-head h3 { margin: 0; font-size: 18px; letter-spacing: -0.02em; }
.hint { font-size: 13px; color: var(--accent); margin-top: 3px; }
.sets-head, .set-row { display: grid; grid-template-columns: 22px 1.15fr 1fr 0.9fr 0.75fr 42px; gap: 6px; align-items: center; }
.sets-head { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); padding: 0 4px 6px; }
.set-row { padding: 5px 4px; border-radius: 14px; transition: background .25s; } /* 26 − 12 */
.set-row.done { background: color-mix(in srgb, var(--green) 14%, transparent); }
.set-row .num { font-weight: 700; color: var(--text-2); text-align: center; font-variant-numeric: tabular-nums; }
.set-row .target { font-size: 12px; color: var(--text-2); text-align: center; font-variant-numeric: tabular-nums; }
.set-row input { text-align: center; padding: 9px 4px; font-variant-numeric: tabular-nums; font-weight: 600; }
.check {
  width: 42px; height: 38px; border-radius: 12px; border: 0; cursor: pointer;
  background: var(--fill); color: var(--text-3); font-size: 18px; font-weight: 700;
  display: grid; place-items: center; transition: all .2s;
}
.set-row.done .check { background: var(--green); color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--green) 45%, transparent); }
.ex-actions { display: flex; gap: 6px; padding: 8px 4px 0; }

/* Таймер отдыха — плавающая капсула */
.timer {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 92px); transform: translateX(-50%);
  z-index: 50; padding: 10px 10px 10px 18px; border-radius: 999px;
  display: flex; align-items: center; gap: 12px; min-width: 220px;
  animation: pop .35s cubic-bezier(.2,1.4,.4,1);
}
.timer b { font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.timer .bar { position: absolute; left: 14px; right: 14px; bottom: 4px; height: 3px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.timer .bar i { display: block; height: 100%; background: var(--accent); transition: width 1s linear; }
@keyframes pop { from { transform: translateX(-50%) scale(.6); opacity: 0; } }

/* ===== Таб-бар: плавающая стеклянная капсула ===== */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 14px);
  display: flex; gap: 2px; padding: 5px; border-radius: 999px; z-index: 40;
  width: min(420px, calc(100% - 32px));
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 4px; border-radius: 999px; color: var(--text-2); text-decoration: none;
  font-size: 10.5px; font-weight: 600; transition: all .25s;
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.active { color: var(--accent); background: var(--fill-2); }
.tabbar a:active { background: var(--fill); }

/* ===== График ===== */
.chart svg { width: 100%; height: auto; display: block; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart .area { fill: url(#grad); }
.chart .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart .axis { fill: var(--text-2); font-size: 11px; font-family: var(--font); }
.chart .gridline { stroke: var(--fill-2); stroke-width: 0.5; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 90px; margin-top: 10px; }
.bars div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bars i { display: block; width: 100%; border-radius: 6px; background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 45%, transparent)); min-height: 3px; }
.bars span { font-size: 11px; color: var(--text-2); }

/* ===== Редактор ===== */
.day-card { padding: 16px; margin-bottom: 14px; }
.pe { padding: 12px; border-radius: 16px; background: var(--fill); margin-top: 10px; }
.pe .grid3 input, .pe .grid2 input, .pe select { padding: 8px 10px; font-size: 15px; }
.pe label.field span { font-size: 11px; margin-bottom: 4px; }
.icon-btn { background: none; border: 0; color: var(--text-3); font-size: 20px; cursor: pointer; padding: 4px 8px; }

/* ===== Модальные окна / тосты ===== */
.sheet-backdrop { position: fixed; inset: 0; background: var(--dim); z-index: 60; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet { width: min(640px, 100%); margin: 8px; padding: 20px; max-height: 85dvh; overflow: auto; border-radius: var(--radius-xl); background: var(--glass-strong); animation: up .3s cubic-bezier(.2,1,.3,1); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 96px); transform: translateX(-50%); z-index: 70; padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: 15px; animation: pop .3s; }

.empty { text-align: center; padding: 40px 20px; color: var(--text-2); }
.empty .big { font-size: 44px; margin-bottom: 8px; }
.view { animation: fade .25s ease; }

.set-row input.rir { font-weight: 500; color: var(--text-2); }
.set-row.flash { background: color-mix(in srgb, var(--orange) 22%, transparent); }

/* Фазы волны */
.phase-dots { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.phase-dots div { padding: 9px 10px; border-radius: 14px; background: var(--fill); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.phase-dots b { font-size: 14px; }
.phase-dots span { font-size: 11px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phase-dots .on { background: var(--accent); color: #fff; }
.phase-dots .on span { color: rgba(255,255,255,.85); }

/* Старт и секундомер тренировки */
.start-card { padding: 18px; }
.start-btn { margin-top: 12px; font-size: 19px; padding: 17px 20px; }
.live-bar { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 20px; margin-bottom: 14px; border-radius: 999px;
  position: sticky; top: calc(env(safe-area-inset-top) + 8px); z-index: 30; }
.live-bar b { font-size: 24px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.timer.ring { animation: ring .5s ease-in-out 4; }
@keyframes ring { 50% { transform: translateX(-50%) scale(1.06); } }
.preset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

/* Кардио */
.cardio-card { padding: 14px 16px; cursor: pointer; }
.cardio-icon { width: 42px; height: 42px; border-radius: 13px; background: var(--fill); display: grid; place-items: center; font-size: 20px; flex: none; }
.cardio-clock { font-size: 20px; font-variant-numeric: tabular-nums; }
.segmented { display: flex; gap: 2px; padding: 3px; border-radius: 13px; background: var(--fill); }
.segmented button { flex: 1; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 4px; border-radius: 10px; cursor: pointer; transition: background .2s; }
.segmented button.on { background: var(--surface); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.cardio-bars i { background: linear-gradient(180deg, var(--orange), color-mix(in srgb, var(--orange) 40%, transparent)); }

a.btn { text-decoration: none; }
.tip { padding: 12px 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.sets-progress { text-align: right; font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; margin-left: 14px; }
.sets-progress .muted { font-weight: 400; }
.ex-title { cursor: pointer; }
.ex-sum { display: none; font-size: 13px; font-weight: 500; color: var(--text-2); margin-top: 3px; }
.done-mark { color: var(--green); margin-right: 6px; }
.ex-card.collapsed { padding-bottom: 6px; }
.ex-card.collapsed .ex-sum { display: block; }
.ex-card.collapsed .sets-head, .ex-card.collapsed .set-row, .ex-card.collapsed .ex-actions,
.ex-card.collapsed .hint, .ex-card.collapsed .ex-head .muted { display: none; }

/* iPhone 16 Pro Max (440×956 pt): цели касания не меньше 44 pt по HIG */
.set-row input { min-height: 44px; }
.check { height: 44px; width: 46px; }
.sets-head, .set-row { grid-template-columns: 22px 1.05fr 1fr 0.95fr 0.8fr 46px; }
.btn.sm { min-height: 38px; }
.tabbar a { min-height: 50px; justify-content: center; }

/* ===== Полноэкранный режим (тренировка, редактор): без таб-бара ===== */
body { --dock: 92px; }
body.fullscreen { --dock: 14px; }
body.fullscreen .tabbar { display: none; }
body.fullscreen #app { padding-bottom: calc(env(safe-area-inset-bottom) + 96px); }
.timer { bottom: calc(env(safe-area-inset-bottom) + var(--dock)); }
.toast { bottom: calc(env(safe-area-inset-bottom) + var(--dock) + 4px); display: flex; align-items: center; gap: 14px; white-space: nowrap; max-width: calc(100% - 32px); }
body.has-timer .toast { bottom: calc(env(safe-area-inset-bottom) + var(--dock) + 72px); }
.toast-action { appearance: none; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 700; padding: 6px 2px; min-height: 36px; cursor: pointer; }

/* Иконки вместо эмодзи */
.ico { width: 22px; height: 22px; display: block; }
.icon-btn { display: grid; place-items: center; min-width: 44px; min-height: 44px; margin: -8px -8px 0 0; }
.cardio-icon { color: var(--accent); }
.empty .big { display: flex; justify-content: center; color: var(--text-3); }
.empty .big .ico { width: 44px; height: 44px; stroke-width: 1.6; }

/* Шторки: полоска сверху, отступ под индикатор «Домой» */
.sheet { padding-top: 8px; padding-bottom: calc(20px + env(safe-area-inset-bottom)); transition: transform .25s cubic-bezier(.2,1,.3,1); }
.grabber { display: block; width: 100%; height: 22px; margin: 0 0 6px; padding: 0; border: 0; background: none; cursor: pointer; position: relative; }
.grabber::after { content: ""; position: absolute; left: 50%; top: 8px; width: 38px; height: 5px; border-radius: 3px; background: var(--fill-2); transform: translateX(-50%); }

/* Кнопки ± шаг при вводе веса/повторов */
.stepper { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 6px 4px 4px; }
.stepper button { appearance: none; border: 0; min-height: 44px; border-radius: 12px; background: var(--fill); color: var(--text);
  font: inherit; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; touch-action: manipulation; }
.stepper button:active { background: var(--fill-2); }

/* Меню фазы */
.more { color: var(--text-2); margin: -10px -10px -10px 0; }

/* Редактор */
.pe-tools { margin-top: 6px; gap: 4px; }
.pe-tools .btn { min-height: 36px; }
.save-bar { position: sticky; bottom: calc(env(safe-area-inset-bottom) + 12px); z-index: 20; margin-top: 12px; }
.btn.ghost.danger { color: var(--red); }
.pe select { font-size: 14px; padding-left: 8px; padding-right: 4px; }

/* ===== Новые функции ===== */
/* Нет сети / очередь */
.net-badge { position: fixed; top: calc(env(safe-area-inset-top) + 6px); left: 50%; transform: translateX(-50%); z-index: 80;
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.net-badge .ico { width: 16px; height: 16px; color: var(--orange); }
/* Таймер: «Дальше: …» над часами */
.timer { max-width: calc(100% - 24px); }
.timer-main { display: flex; flex-direction: column; min-width: 0; max-width: 200px; }
.timer-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Заметка к упражнению и разминка */
.ex-note { display: flex; gap: 6px; align-items: flex-start; margin-top: 6px; font-size: 13px; color: var(--text); background: var(--fill); padding: 6px 10px; border-radius: 10px; }
.ex-note .ico { width: 14px; height: 14px; flex: none; margin-top: 2px; color: var(--orange); }
.warmup { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.ex-card.collapsed .ex-note, .ex-card.collapsed .warmup { display: none; }
/* Суперсет: связка между карточками */
.ss-link { display: flex; align-items: center; justify-content: center; gap: 8px; margin: -6px 0 6px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.ss-link::before, .ss-link::after { content: ""; width: 2px; height: 12px; border-radius: 1px; background: var(--accent); opacity: .5; }
/* Рекорд в подходе */
.set-row.pr .num { color: var(--orange); }
.set-row.pr .num::after { content: "★"; font-size: 10px; vertical-align: super; }
.rec-ico .ico, .row-ico .ico { color: var(--orange); }
.row-ico .ico { color: var(--accent); }
.chip.warn { background: color-mix(in srgb, var(--orange) 20%, transparent); color: var(--orange); }
/* Самочувствие */
.field-label { font-size: 15px; margin: 0 4px 8px; display: flex; gap: 8px; align-items: baseline; }
.field-label b { font-size: 22px; font-variant-numeric: tabular-nums; }
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; background: transparent; padding: 0; border: 0; }
.range::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--green), var(--orange), var(--red)); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; margin-top: -12px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.25), 0 0 0 .5px rgba(0,0,0,.1); }
.range:focus { background: transparent; border: 0; }
.lighten { display: flex; gap: 12px; align-items: center; margin-top: 16px; padding: 12px 14px; border-radius: 16px; background: color-mix(in srgb, var(--orange) 14%, transparent); }
.lighten input { width: 24px; height: 24px; flex: none; accent-color: var(--orange); }
/* Кнопка-строка списка и переключатель в стиле iOS */
.item-btn { width: 100%; border: 0; background: none; font: inherit; color: inherit; text-align: left; }
.switch { -webkit-appearance: none; appearance: none; width: 51px; height: 31px; flex: none; border-radius: 999px; background: var(--fill-2); position: relative; padding: 0; border: 0; cursor: pointer; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); transition: transform .2s; }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }
.switch:focus { border: 0; background: var(--fill-2); }
.switch:checked:focus { background: var(--green); }
.ss-toggle { margin-top: 10px; gap: 10px; color: var(--text); }
/* Календарь */
.cal-card { padding-bottom: 14px; }
.cal-months { display: grid; gap: 3px; margin-top: 14px; font-size: 11px; color: var(--text-2); }
.cal-months span { white-space: nowrap; }
.cal-grid { display: grid; grid-template-rows: repeat(7, auto); gap: 3px; margin-top: 4px; }
.cal-grid i { aspect-ratio: 1; border-radius: 4px; background: var(--fill); }
.cal-grid i.on { background: var(--accent); }
.cal-grid i.future { background: transparent; }
.cal-grid i.today { box-shadow: inset 0 0 0 1.5px var(--accent); }
/* Подходы на мышцы */
.mbars { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.mbar { display: grid; grid-template-columns: 64px 1fr 28px; gap: 10px; align-items: center; font-size: 14px; }
.mbar b { text-align: right; font-variant-numeric: tabular-nums; }
.mtrack { position: relative; height: 10px; border-radius: 5px; background: var(--fill); }
.mtrack i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; background: var(--accent); }
.mtrack em { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--text-2); }
.avg-key { display: inline-block; width: 2px; height: 10px; background: var(--text-2); vertical-align: -1px; margin: 0 2px; }
body.fullscreen .net-badge { top: calc(env(safe-area-inset-top) + 78px); }
