/* ============================================================
   BODY PROTOCOL — дизайн-система «Circuit»
   Абсолютный чёрный · янтарь и серебро · тонкая линия · неон
   ------------------------------------------------------------
   Построена по логотипу. Оттуда взято всё:
   • фон — чистый чёрный, а не тёмно-серый: свечение работает
     только на нём;
   • двойственность янтарь / серебро — левая и правая половина
     фигуры. Янтарь = питание и действие, серебро = тело и факт;
   • линия тонкая, в один пиксель: логотип нарисован волосяным
     контуром, толстые границы его бы огрубили;
   • свет вместо теней. Объём даёт не тень под панелью, а
     подсветка грани и мягкий ореол;
   • схемотехника: прямые углы дорожек и точки-контакты на концах.

   Акцент задаётся переменными --acc-* и --ag-* (серебро).
   Старые имена (--volt, --mint, --glass) оставлены псевдонимами:
   на них завязан весь прежний код разметки.
   ============================================================ */
:root {
  /* Янтарь — снят с левой половины логотипа */
  --acc-rgb: 255, 176, 31;
  --acc-2-rgb: 232, 137, 11;        /* глубокий, к низу свечения */
  --acc-3-rgb: 255, 206, 92;        /* светлый блик */

  --acc: rgb(var(--acc-rgb));
  --acc-2: rgb(var(--acc-2-rgb));
  --acc-3: rgb(var(--acc-3-rgb));
  --acc-ink: #0a0700;

  /* Серебро — правая половина логотипа */
  --ag-rgb: 226, 232, 240;
  --ag: rgb(var(--ag-rgb));
  --ag-dim: #8b939e;

  --bg: #000000;                    /* именно чистый чёрный */
  --bg-2: #050506;
  --panel: rgba(255, 255, 255, .022);
  --panel-2: rgba(255, 255, 255, .045);

  /* Линии волосяные: 1px и низкая непрозрачность */
  --line: rgba(255, 255, 255, .09);
  --line-hi: rgba(var(--acc-rgb), .38);

  --glass: var(--panel);
  --glass-2: var(--panel-2);
  --stroke: var(--line);
  --stroke-hi: var(--line-hi);

  /* Контраст к чёрному: text 19:1, muted 7.4:1, muted-2 4.8:1 —
     у самого тусклого оттенка запас над AA минимален, темнее не делать. */
  --text: #f2f5f8;
  --muted: #98a1ad;
  --muted-2: #6f7885;

  --volt: var(--acc);
  --volt-2: var(--acc-2);
  --mint: var(--ag);
  --volt-ink: var(--acc-ink);

  --blue: var(--ag);
  --danger: #ff4d5e;

  /* Единая шкала скруглений. Раньше значения расходились по файлам
     и элементы одного уровня выглядели по-разному. */
  --r-lg: 18px;   /* карточки, листы, крупные блоки */
  --r-md: 14px;   /* кнопки, сегменты, иконочные кнопки */
  --r-sm: 12px;   /* поля ввода, мелкие плашки */
  --r-pill: 999px;/* чипы и всё, что должно быть капсулой */
  --bw: 1px;
  --dock-h: 76px;

  --font-display: 'Michroma', 'Eurostile', 'Arial Black', sans-serif;
  --font-label: 'Rajdhani', 'Segoe UI', sans-serif;
  --font-body: 'Manrope', 'Segoe UI', sans-serif;
  --font-mono: 'Rajdhani', 'Consolas', monospace;

  --grad-volt: linear-gradient(135deg, var(--acc-3) 0%, var(--acc) 45%, var(--acc-2) 100%);

  /* Свет вместо теней */
  --glow-acc: 0 0 24px rgba(var(--acc-rgb), .28);
  --glow-acc-s: 0 0 12px rgba(var(--acc-rgb), .45);
  --glow-ag: 0 0 20px rgba(var(--ag-rgb), .18);
  --shadow-card: 0 1px 0 rgba(255,255,255,.04) inset, 0 18px 40px rgba(0,0,0,.7);
  --shadow-hard: var(--shadow-card);
  --glow-volt: var(--glow-acc);

  /* Токены, которые светлая тема переворачивает.
     Раньше «дно» и блики были вписаны числами прямо в правила, поэтому
     светлая тема их не касалась: панели плеера и чипы оставались чёрными
     на белой странице. */
  --ink: #000000;                       /* подложка чипов, дорожек, листов */
  --sheen: rgba(255,255,255,.05);       /* блик по верхней грани */
  --sheen-2: rgba(255,255,255,.012);    /* его продолжение к середине */
  --sheen-hi: rgba(255,255,255,.10);    /* блик на выпуклых элементах */
  --track: rgba(255,255,255,.06);       /* дорожка прогресса */
  --grip: rgba(255,255,255,.18);        /* «ручка» листа снизу */
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overscroll-behavior-y: contain;
}
/* Фон — ровный тёмный. Единственный слой сверху — очень слабое зерно:
   оно не читается как текстура, но убирает полосы на градиентах карточек. */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  opacity: .6;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.035'/%3E%3C/svg%3E");
}

/* --kb — высота системной клавиатуры, её ставит keyboard.js. Пока клавиатура
   открыта, вьюпорт ужат на эту высоту, и без запаса снизу последнему полю
   просто некуда прокручиваться (ТЗ 26.08, п.3). */
#app { max-width: 560px; margin: 0 auto; padding: 20px 18px calc(var(--dock-h) + 110px + var(--kb, 0px)); min-height: 100vh; }

/* ---------- Типографика ---------- */
h1, h2, .display { font-family: var(--font-display); letter-spacing: -.015em; }
h1 { font-size: clamp(1.4rem, 6vw, 1.7rem); font-weight: 800; text-transform: uppercase; line-height: 1.08; }
h2 { font-size: .95rem; font-weight: 700; }
.kicker { font-size: .64rem; font-weight: 800; letter-spacing: .26em; text-transform: uppercase; color: var(--volt); }
.muted { color: var(--muted); } .small { font-size: .8rem; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Появление страниц ---------- */
@keyframes rise-in { from { opacity: 0; transform: translateY(22px) scale(.985); } to { opacity: 1; transform: none; } }
#view > * { animation: rise-in .5s cubic-bezier(.2, .8, .25, 1) both; }
#view > *:nth-child(1) { animation-delay: .02s; } #view > *:nth-child(2) { animation-delay: .07s; }
#view > *:nth-child(3) { animation-delay: .12s; } #view > *:nth-child(4) { animation-delay: .17s; }
#view > *:nth-child(5) { animation-delay: .22s; } #view > *:nth-child(6) { animation-delay: .26s; }
#view > *:nth-child(n+7) { animation-delay: .3s; }

/* ---------- Шапка ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.hello .hi { color: var(--muted); font-size: .82rem; font-weight: 700; }
.hello h1 { margin-top: 2px; }
.logo { font-family: var(--font-display); font-weight: 800; font-size: 1rem; letter-spacing: .02em; }
.logo em { font-style: normal; color: var(--volt); }
.avatar {
  width: 42px; height: 42px; border-radius: 0; display: flex; align-items: center; justify-content: center;
  background: var(--glass-2); border: 1px solid var(--stroke); font-size: 1.15rem;
}

/* ---------- Стекло-карточки ---------- */
.card {
  position: relative;
  background: linear-gradient(165deg, var(--glass-2) 0%, var(--glass) 60%);
  border: 1px solid var(--stroke);
  border-radius: 0;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-card);
}
.card.tight { padding: 14px; border-radius: 0; }
.card.press { cursor: pointer; transition: transform .12s ease, border-color .2s; }
.card.press:active { transform: scale(.975); border-color: var(--stroke-hi); }

/* Hero */
.hero {
  overflow: hidden;
  background:
    radial-gradient(120% 130% at 85% -20%, rgba(var(--acc-rgb), .16), transparent 55%),
    linear-gradient(165deg, var(--sheen-hi) 0%, var(--sheen-2) 100%);
  border-color: rgba(var(--acc-rgb), .22);
}
.hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: 0;
  background: repeating-linear-gradient(-58deg, transparent 0 26px, rgba(var(--acc-rgb), .045) 26px 27px);
  mask-image: linear-gradient(120deg, #000 30%, transparent 75%);
}
.hero-flex { display: flex; gap: 14px; align-items: center; }
.hero-flex .grow { flex: 1; min-width: 0; }

/* Кольцо недели */
.ring-wrap { position: relative; width: 84px; height: 84px; flex: 0 0 auto; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-wrap .lbl {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ring-wrap .lbl b { font-family: var(--font-display); font-size: 1.05rem; }
.ring-wrap .lbl span { font-size: .55rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 800; }

/* ---------- Лента недели ---------- */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wday { text-align: center; padding: 10px 2px 9px; border-radius: 0; border: 1px solid transparent; }
.wday .d { font-size: .58rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); }
.wday .m { margin-top: 5px; font-size: .95rem; line-height: 1.4; font-family: var(--font-display); font-weight: 800; color: var(--muted); }
.wday.today { border-color: rgba(var(--acc-rgb), .4); background: rgba(var(--acc-rgb), .06); }
.wday.done .m { color: var(--volt); }
.wday.done .d { color: var(--muted); }

/* ---------- Статы ---------- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat {
  background: var(--glass); border: 1px solid var(--stroke); border-radius: 0;
  padding: 14px 8px 11px; text-align: center;
}
.stat b {
  display: block; font-family: var(--font-display); font-size: clamp(1.15rem, 5.4vw, 1.45rem);
  font-weight: 800; background: var(--grad-volt); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat span { font-size: .6rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 800; }

/* ---------- Кнопки ---------- */
button { font-family: inherit; cursor: pointer; border: 0; color: inherit; background: none; }
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 16px 18px; border-radius: 0;
  font-weight: 800; font-size: .95rem;
  background: var(--glass-2); border: 1px solid var(--stroke);
  transition: transform .1s ease, border-color .2s;
}
.btn:active { transform: scale(.965); }
.btn.volt {
  background: var(--grad-volt); color: var(--volt-ink); border: 0;
  font-family: var(--font-display); text-transform: uppercase; font-size: .82rem; letter-spacing: .04em;
  box-shadow: var(--glow-volt);
}
.btn.volt::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 46%; left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.5), transparent);
  animation: shine 3.2s ease infinite;
}
@keyframes shine { 0%, 55% { left: -60%; } 85%, 100% { left: 130%; } }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: rgba(255, 59, 92, .28); }
.icon-btn {
  width: 42px; height: 42px; border-radius: 0; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--glass-2); border: 1px solid var(--stroke); font-size: 1rem; color: var(--muted);
  transition: transform .1s;
}
.icon-btn:active { transform: scale(.9); }

/* ---------- Списки-строки ---------- */
.prog-item { display: flex; align-items: center; gap: 14px; }
.prog-item .dot {
  width: 50px; height: 50px; border-radius: 0; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 1.05rem;
  background: rgba(var(--acc-rgb), .1); color: var(--volt); border: 1px solid rgba(var(--acc-rgb), .25);
  text-shadow: 0 0 18px rgba(var(--acc-rgb), .6);
}
.prog-item .grow { flex: 1; min-width: 0; }
.prog-item .name { font-weight: 800; font-size: .95rem; line-height: 1.25; }
.prog-item .sub { color: var(--muted); font-size: .78rem; margin-top: 3px; }
.chev { color: var(--muted-2); font-size: 1.3rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  font-size: .62rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); background: var(--glass); border: 1px solid var(--stroke);
  padding: 4px 9px; border-radius: 0;
}

/* ---------- ПЛЕЕР ---------- */
.wo-head {
  position: sticky; top: 0; z-index: 30; margin: -20px -18px 16px; padding: 16px 18px 12px;
  background: var(--bg); border-bottom: 1px solid var(--stroke);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.wo-head .t h1 { font-size: 1.1rem; }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 0; background: var(--volt); margin-right: 6px;
  box-shadow: 0 0 10px var(--volt); animation: pulse 1.6s ease infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.elapsed-pill {
  font-family: var(--font-display); font-weight: 800; font-size: .95rem; color: var(--volt);
  background: rgba(var(--acc-rgb), .09); border: 1px solid rgba(var(--acc-rgb), .3);
  padding: 9px 13px; border-radius: 0; white-space: nowrap;
}

.wo-ex { padding: 16px; }
.wo-ex-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.ex-idx {
  font-family: var(--font-display); font-weight: 800; font-size: .8rem; color: var(--muted-2);
  border: 1px solid var(--stroke); border-radius: 0; padding: 6px 8px; flex: 0 0 auto;
}
.wo-ex-head .grow { flex: 1; min-width: 0; }
.wo-ex-head .t { font-weight: 800; font-size: .95rem; line-height: 1.3; }
.wo-ex-head .plan { color: var(--muted); font-size: .72rem; margin-top: 3px; font-weight: 700; }
.setbar { height: 4px; border-radius: 0; background: var(--glass-2); margin: 10px 0 12px; overflow: hidden; }
.setbar i { display: block; height: 100%; border-radius: 0; background: var(--grad-volt); transition: width .4s cubic-bezier(.2,.8,.3,1); }

.prev-hint {
  font-size: .74rem; color: var(--muted); background: rgba(var(--acc-3-rgb), .05);
  border: 1px dashed rgba(var(--acc-3-rgb), .25); border-radius: 0; padding: 8px 11px; margin-bottom: 11px;
}
.prev-hint b { color: var(--blue); font-weight: 700; }

.set-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.set-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--glass-2); border: 1px solid var(--stroke-hi); border-radius: 0;
  padding: 8px 11px; font-size: .84rem; font-weight: 700;
  animation: chip-pop .35s cubic-bezier(.2, 1.4, .4, 1) both;
}
@keyframes chip-pop { from { opacity: 0; transform: scale(.6); } }
.set-chip b { font-family: var(--font-display); font-size: .88rem; color: var(--volt); }
.set-chip.pr { border-color: rgba(var(--acc-rgb), .55); background: rgba(var(--acc-rgb), .1); box-shadow: 0 0 22px rgba(var(--acc-rgb), .15); }
.set-chip .x { color: var(--muted-2); font-size: .85rem; padding: 0 1px; }

.set-input { display: grid; grid-template-columns: 1fr 1.7fr; gap: 9px; align-items: stretch; }
.set-input .add-set-btn { grid-column: 1 / -1; height: 50px; flex: none; font-size: .9rem; font-family: var(--font-label); letter-spacing: .08em; text-transform: uppercase; }
.set-input .add-set-btn::before { content: '✓  '; font-size: 1.1rem; }
.stepper {
  flex: 1; display: flex; align-items: center; background: rgba(0,0,0,.35);
  border: 1px solid var(--stroke); border-radius: 0; overflow: hidden;
}
.stepper button { width: 32px; flex: 0 0 32px; align-self: stretch; font-size: 1.25rem; color: var(--muted); font-weight: 700; transition: color .15s; }
.stepper.w5 .mid { min-width: 84px; }
.stepper button.big { width: 34px; flex-basis: 34px; font-size: .76rem; font-weight: 800; letter-spacing: 0; color: var(--muted-2); }
.stepper button.big:active { color: var(--volt); }
.set-chip .n { font-style: normal; color: var(--muted-2); font-size: .68rem; margin-right: 2px; }
.wo-ex.done { opacity: .75; padding: 10px 14px; }
.wo-ex.done .wo-ex-head { margin-bottom: 0; }
.wo-ex.done .plan { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-extra { display: flex; gap: 8px; flex-wrap: wrap; }
.stepper button:active { color: var(--volt); }
.stepper .mid { flex: 1; min-width: 64px; text-align: center; padding: 9px 2px 7px; }
.stepper .mid input {
  width: 100%; min-width: 0; padding: 0; border-radius: 0; background: none; border: 0; color: var(--text); text-align: center;
  font-family: var(--font-label); font-size: 1.45rem; font-weight: 800; outline: none; letter-spacing: 0;
  -moz-appearance: textfield; appearance: textfield;
}
.stepper .mid input::-webkit-outer-spin-button,
.stepper .mid input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper .mid label { display: block; font-size: .56rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted-2); font-weight: 800; }
.add-set-btn {
  flex: 0 0 54px; border-radius: 0; background: var(--grad-volt); color: var(--volt-ink);
  font-size: 1.55rem; font-weight: 800; box-shadow: var(--glow-volt); transition: transform .1s;
}
.add-set-btn:active { transform: scale(.92); }

/* ---------- ТАЙМЕР ОТДЫХА (оверлей) ---------- */
#rest-overlay {
  position: fixed; inset: 0; z-index: 90; display: none;
  align-items: center; justify-content: center; flex-direction: column; gap: 26px;
  background: rgba(6, 5, 4, .82);
}
#rest-overlay.on { display: flex; animation: fade .25s ease; }
#rest-overlay .kicker { animation: pulse 2s ease infinite; }
.rest-ring { position: relative; width: 240px; height: 240px; }
.rest-ring svg { transform: rotate(-90deg); filter: drop-shadow(0 0 24px rgba(var(--acc-rgb), .35)); }
.rest-ring .mid {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.rest-ring .mid b { font-family: var(--font-display); font-size: 3.1rem; font-weight: 800; letter-spacing: -.02em; }
.rest-ring .mid span { color: var(--muted); font-size: .72rem; font-weight: 700; margin-top: 4px; }
.rest-ctl { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; padding: 0 18px; }
.rest-ctl .btn { width: auto; padding: 13px 18px; font-size: .85rem; }

/* мини-пилюля таймера */
#rest-mini {
  position: fixed; left: 50%; bottom: calc(var(--dock-h) + 22px); transform: translateX(-50%);
  z-index: 60; display: none; align-items: center; gap: 10px;
  background: rgba(18, 13, 8, .9); border: 1px solid rgba(var(--acc-rgb), .4); border-radius: 0;
  padding: 10px 18px; box-shadow: 0 14px 40px rgba(0,0,0,.5);
  cursor: pointer;
}
#rest-mini.on { display: flex; animation: mini-in .3s ease both; }
@keyframes mini-in { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }
#rest-mini b { font-family: var(--font-display); font-size: 1.05rem; color: var(--volt); }
#rest-mini span { font-size: .72rem; color: var(--muted); font-weight: 700; }

/* ---------- ИСТОРИЯ ---------- */
.month-label { margin: 20px 2px 10px; }
.hist-item { display: flex; align-items: center; gap: 14px; }
.hist-item .day {
  width: 52px; height: 52px; flex: 0 0 auto; border-radius: 0; text-align: center;
  background: var(--glass-2); border: 1px solid var(--stroke);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.hist-item .day b { font-family: var(--font-display); font-size: 1.1rem; line-height: 1; }
.hist-item .day span { font-size: .55rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 800; margin-top: 2px; }

/* ---------- ГРАФИКИ ---------- */
canvas.chart { width: 100%; height: 200px; display: block; touch-action: pan-y; }
.seg {
  display: flex; background: var(--glass); border: 1px solid var(--stroke);
  border-radius: 0; padding: 5px; gap: 5px; margin-bottom: 14px; overflow-x: auto;
}
.seg button {
  flex: 1; padding: 10px 12px; border-radius: 0; font-weight: 800; font-size: .76rem;
  color: var(--muted); white-space: nowrap; transition: all .2s;
}
.seg button.on { background: var(--grad-volt); color: var(--volt-ink); box-shadow: 0 4px 18px rgba(var(--acc-rgb), .25); }

/* Перечисляем типы явно, а не просто input: иначе под правило попали бы
   чекбоксы, файлы и кнопки. Пароль, почта и время были пропущены — поля
   выходили заметно ниже соседних. */
select, textarea,
input[type="text"], input[type="number"], input[type="date"],
input[type="password"], input[type="email"], input[type="time"],
input[type="tel"], input[type="search"] {
  width: 100%; padding: 14px 15px; border-radius: 0;
  background: var(--glass); border: 1px solid var(--stroke); color: var(--text);
  font-family: inherit; font-size: .95rem; font-weight: 600; outline: none;
  /* Явная межстрочная: у шрифта точек в поле пароля своя метрика,
     и при line-height: normal поле выходило на пару пикселей ниже соседних */
  line-height: 1.4;
}
select { -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2398a29a' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; }
select:focus, input:focus { border-color: rgba(var(--acc-rgb), .5); }
select option { background: #101312; color: var(--text); }
label.fld { display: block; margin-bottom: 12px; }
label.fld span { display: block; font-size: .64rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 800; margin-bottom: 7px; }

.pr-line { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--stroke); font-size: .88rem; }
.pr-line:last-child { border-bottom: 0; }
.pr-line b { font-family: var(--font-display); color: var(--volt); font-size: 1rem; }

/* ---------- КАТАЛОГ УПРАЖНЕНИЙ ---------- */
.muscle-ico { width: 34px; height: 68px; flex: 0 0 auto; filter: drop-shadow(0 2px 8px rgba(0,0,0,.5)); }
.grp-item {
  display: flex; align-items: center; gap: 14px; padding: 10px 6px;
  border-bottom: 1px solid var(--stroke); cursor: pointer; transition: background .15s;
}
.grp-item:active { background: var(--glass); }
.grp-item .nm { flex: 1; font-weight: 800; font-size: .95rem; }
.grp-item .cnt {
  color: var(--volt); font-size: .72rem; font-weight: 800;
  background: rgba(var(--acc-rgb), .08); border: 1px solid rgba(var(--acc-rgb), .22);
  padding: 3px 9px; border-radius: 0;
}
/* Иллюстрация упражнения — PNG 192×192 с прозрачным фоном из img/ex/.
   Фигура тёмная, поэтому под неё подложена плашка --panel-2:
   на чистом чёрном силуэт иначе сливается с фоном. */
.picto {
  width: 46px; height: 46px; flex: 0 0 auto; box-sizing: border-box;
  background: var(--panel-2); border: 1px solid var(--stroke);
  border-radius: 0; padding: 2px; object-fit: contain;
  /* Рендеры сняты в тёмном ключе: на 46 px без подсветки они читаются
     как силуэт-пятно, поэтому чуть поднимаем яркость. */
  filter: brightness(1.22) contrast(1.04);
}
.picto-empty { display: inline-block; }

/* ---- Карточка упражнения ----
   Открывается тапом по строке каталога или по картинке в тренировке. */
.picto-btn { padding: 0; border: 0; background: none; line-height: 0; flex: 0 0 auto; cursor: pointer; }
.picto.big { width: 96px; height: 96px; padding: 4px; }
.sheet-head h2.grow { flex: 1; margin-left: 12px; }
.ex-card-top { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.ex-sum { font-size: .88rem; line-height: 1.45; color: var(--muted); margin-top: 6px; }
.ex-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ex-stat { background: var(--panel); border: 1px solid var(--stroke); padding: 10px 6px; text-align: center; }
.ex-stat b { display: block; font-size: 1.05rem; color: var(--acc); }
.ex-stat span {
  display: block; font-size: .6rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted-2); margin-top: 4px; line-height: 1.3;
}
.ex-last { font-size: .74rem; color: var(--muted); margin-top: 8px; }
.ex-last.muted { color: var(--muted-2); }
.ex-sec { margin-top: 18px; }
.ex-sec .kicker { margin-bottom: 8px; }
.ex-steps { margin: 0; padding-left: 20px; }
.ex-steps li { font-size: .86rem; line-height: 1.5; margin-bottom: 7px; }
.ex-steps li::marker { color: var(--acc); font-weight: 800; }
.ex-err { margin: 0; padding-left: 18px; list-style: none; }
.ex-err li { font-size: .84rem; line-height: 1.45; margin-bottom: 7px; position: relative; }
.ex-err li::before { content: '✕'; position: absolute; left: -18px; color: var(--danger); font-weight: 800; }
.ex-mus b { font-size: .9rem; }
.ex-mus span { display: block; font-size: .78rem; color: var(--muted); margin-top: 3px; }
.ex-tip {
  font-size: .84rem; line-height: 1.5; color: var(--muted);
  border-left: 2px solid var(--acc); padding-left: 12px;
}
.ex-info { flex: 0 0 auto; font-style: italic; font-weight: 800; }
.ex-row {
  display: flex; align-items: center; gap: 12px; padding: 9px 2px;
  border-bottom: 1px solid var(--stroke); cursor: pointer; transition: background .15s;
}
.ex-row:last-child { border-bottom: 0; }
.ex-row:active { background: var(--glass); }
.ex-row .grow { flex: 1; min-width: 0; }
.ex-row .nm { font-weight: 700; font-size: .86rem; line-height: 1.3; }
.ex-row .sub { color: var(--muted-2); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-top: 2px; }
.ex-back-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }

/* ---------- ДОК ---------- */
#nav {
  position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 50;
  width: min(536px, calc(100% - 24px));
}
#nav .inner {
  display: flex; height: var(--dock-h); border-radius: 0;
  background: rgba(12, 10, 9, .78); border: 1px solid var(--stroke-hi); box-shadow: 0 22px 60px rgba(0,0,0,.6);
  overflow: hidden;
}
#nav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--muted-2); font-size: .56rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  position: relative; transition: color .2s;
}
#nav button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; transition: transform .2s; }
#nav button.on { color: var(--volt); }
#nav button.on svg { transform: translateY(-1px); filter: drop-shadow(0 0 10px rgba(var(--acc-rgb), .7)); }
#nav button.on::before {
  content: ''; position: absolute; top: 8px; width: 26px; height: 3px; border-radius: 0;
  background: var(--grad-volt); box-shadow: 0 0 12px rgba(var(--acc-rgb), .8);
}

/* ---------- ЛИСТЫ / МОДАЛКИ ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 80; background: rgba(5, 3, 2, .7);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  background: linear-gradient(180deg, #14171488, #0b0d0cee), #0b0d0c;
  border: 1px solid var(--stroke-hi); border-bottom: 0;
  border-radius: 0; padding: 10px 18px 36px;
  animation: up .3s cubic-bezier(.2, .9, .25, 1);
  touch-action: pan-y;
}
/* Ручка сверху — подсказка, что лист можно утянуть вниз */
.sheet-grip { width: 40px; height: 4px; margin: 0 auto 10px; background: var(--grip); border-radius: 2px; }
html.light .sheet-grip { background: rgba(0,0,0,.18); }
@keyframes up { from { transform: translateY(56px); opacity: .3; } }
.sheet::before {
  content: ''; display: block; width: 44px; height: 4px; border-radius: 0;
  background: var(--stroke-hi); margin: 6px auto 16px;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sheet-head h2 { font-size: 1.05rem; text-transform: uppercase; }

.toast {
  position: fixed; left: 50%; top: 20px; transform: translateX(-50%); z-index: 100;
  background: var(--grad-volt); color: var(--volt-ink); font-weight: 800; font-size: .85rem;
  padding: 12px 22px; border-radius: 0; box-shadow: var(--glow-volt);
  animation: toast 2.4s ease forwards; max-width: calc(100% - 40px); text-align: center;
}
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -14px) scale(.9); } 12%, 80% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; transform: translate(-50%, -14px) scale(.95); } }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .big { font-size: 2.6rem; margin-bottom: 12px; filter: grayscale(.3); }

.ex-cat-item { display: flex; align-items: center; gap: 10px; padding: 12px 2px; border-bottom: 1px solid var(--stroke); cursor: pointer; }
.ex-cat-item:last-child { border-bottom: 0; }
.ex-cat-item .g {
  font-size: .58rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--volt); background: rgba(var(--acc-rgb), .08); border: 1px solid rgba(var(--acc-rgb), .22);
  padding: 4px 9px; border-radius: 0; flex: 0 0 auto;
}
.ex-cat-item .nm { flex: 1; font-weight: 700; font-size: .88rem; }

.export-box {
  width: 100%; min-height: 230px; font-family: 'Consolas', monospace; font-size: .78rem;
  line-height: 1.55; background: rgba(0,0,0,.4); color: var(--muted);
}

/* «Ещё» — плитки */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  background: linear-gradient(165deg, var(--glass-2), var(--glass));
  border: 1px solid var(--stroke); border-radius: 0; padding: 18px 16px;
  cursor: pointer; transition: transform .12s, border-color .2s;
}
.tile:active { transform: scale(.96); }
.tile .ico { font-size: 1.5rem; }
.tile .name { font-weight: 800; font-size: .88rem; margin-top: 10px; }
.tile .sub { color: var(--muted); font-size: .72rem; margin-top: 3px; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mt { margin-top: 12px; } .mb { margin-bottom: 12px; }

#confetti { position: fixed; inset: 0; z-index: 120; pointer-events: none; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: var(--stroke-hi); border-radius: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================================================
   Правовые экраны и согласия (legal.js)
   ------------------------------------------------------------
   Документ читают один раз и, как правило, вынужденно. Значит
   задача типографики здесь ровно одна — не мешать: широкая строка,
   спокойный межстрочный, заголовки видны без украшений. Ничего
   «фирменного»: приём, уместный на экране тренировки, в тексте
   про обработку данных читается как попытка отвлечь.
   ============================================================ */
.legal-doc {
  font-size: .88rem;
  line-height: 1.62;
  color: var(--text);
  max-height: 58vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
}
.legal-doc h3 {
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--volt);
  margin: 18px 0 6px;
}
.legal-doc h3:first-child { margin-top: 0; }
.legal-doc p { margin: 0 0 10px; }
.legal-doc ul { margin: 0 0 12px; padding-left: 18px; }
.legal-doc li { margin-bottom: 5px; }
.legal-doc b { font-weight: 700; }
.legal-doc .muted { font-size: .78rem; }
.legal-doc .warn-box { margin-bottom: 12px; }

/* Ссылка внутри текста. Именно button, а не <a>: перехода никуда нет,
   открывается лист поверх. Экранной читалке так и сообщается. */
.lnk {
  background: none; border: 0; padding: 0; font: inherit;
  color: var(--volt); text-decoration: underline;
  text-underline-offset: 2px; cursor: pointer;
}
.lnk:hover { color: var(--volt-2); }

/* Согласия. Флажок крупный — по нему попадают пальцем, и он же
   единственное действие на экране, которое нельзя сделать случайно. */
.consent-box {
  margin: 14px 0 4px;
  padding: 14px;
  border: var(--bw) solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  display: flex; flex-direction: column; gap: 12px;
}
.consent-row {
  display: flex; align-items: flex-start; gap: 11px;
  font-size: .84rem; line-height: 1.5; cursor: pointer;
}
.consent-row input[type=checkbox] {
  flex: 0 0 auto;
  width: 22px; height: 22px; margin-top: 1px;
  accent-color: var(--volt);
  cursor: pointer;
}
.consent-row span { flex: 1 1 auto; }
.consent-box .muted { font-size: .78rem; line-height: 1.5; }

/* Уведомление о хранении на устройстве. Снизу, над нижней навигацией,
   не перекрывает содержимое и уезжает по «Понятно». Появляется один раз. */
#storage-notice {
  position: fixed; z-index: 60;
  left: 12px; right: 12px;
  bottom: calc(var(--nav-h, 68px) + 12px + env(safe-area-inset-bottom, 0px));
  padding: 14px 16px;
  border: var(--bw) solid var(--line);
  border-radius: var(--r-lg);
  background: rgba(12, 12, 14, .96);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .6);
  display: flex; flex-direction: column; gap: 12px;
  transform: translateY(140%);
  transition: transform .26s cubic-bezier(.22, .8, .3, 1);
}
#storage-notice.on { transform: none; }
#storage-notice .sn-text { font-size: .82rem; line-height: 1.5; color: var(--text); }
#storage-notice .sn-btns { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
#storage-notice .btn.sm { width: auto; padding: 9px 18px; font-size: .8rem; }

@media (min-width: 620px) {
  #storage-notice { left: auto; right: 20px; max-width: 420px; }
}
