/* ==========================================================================
   Зал — тёмный «приборный» интерфейс: графит, волосяные линии, вольт-акцент.
   ========================================================================== */

:root {
  --bg: #0a0b0d;
  --bg-2: #0e1013;
  --surface: #131619;
  --surface-2: #191d21;
  --surface-3: #20252a;
  --paper: var(--surface);
  --ink: #eef0ea;
  --ink-2: #c9cdc6;
  --muted: #868d95;
  --faint: #5b626a;
  --line: rgba(255, 255, 255, 0.065);
  --line-strong: rgba(255, 255, 255, 0.12);
  --accent: #c8ff2e;
  --accent-2: #a6e600;
  --accent-soft: rgba(200, 255, 46, 0.09);
  --accent-line: rgba(200, 255, 46, 0.38);
  --accent-ink: #c8ff2e;
  --on-accent: #0a0b0d;
  --coach: #c8ff2e;
  --coach-line: rgba(200, 255, 46, 0.45);
  --warn: #ffb547;
  --warn-bg: rgba(255, 181, 71, 0.08);
  --warn-line: rgba(255, 181, 71, 0.32);
  --peak: rgba(200, 255, 46, 0.06);
  --focus: var(--accent);
  --plate: #ecebe6;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 30px -18px rgba(0, 0, 0, 0.8);
  --shadow-panel: var(--shadow);
  --font-display: "Unbounded", "Manrope", "Segoe UI", sans-serif;
  --font-body: "Manrope", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dock-h: 0px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  scroll-behavior: auto;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1.2px),
    radial-gradient(1100px 560px at -5% -12%, rgba(200, 255, 46, 0.07), transparent 62%),
    radial-gradient(900px 520px at 105% -8%, rgba(77, 163, 255, 0.06), transparent 60%);
  background-size: 24px 24px, auto, auto;
  background-attachment: fixed;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 450;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: rgba(200, 255, 46, 0.3); color: #fff; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border: 3px solid var(--bg);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.18); }

a { color: inherit; text-underline-offset: 0.18em; }

button, input, select { font: inherit; color: inherit; }

.app {
  width: min(1640px, calc(100% - 3rem));
  margin: 0 auto;
  padding-bottom: 3.5rem;
}

.wrap { /* legacy alias if any */ }

/* ---------- Типографика ---------- */

h2, .exercise-card h3 {
  margin: 0.15rem 0 0;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

h2 { font-size: 1.28rem; }

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.12rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.kicker::before {
  content: "";
  width: 0.38rem;
  height: 0.38rem;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(200, 255, 46, 0.6);
  flex: none;
}

.brand-copy .kicker::before { display: none; }

.eyebrow, .equipment {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.when, .meta, .caption, .hint, .note, .set-note {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.caption.suggest { color: var(--ink-2); }

.focus {
  margin: 0;
  color: var(--focus);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.lede { display: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Шапка ---------- */

.topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.85rem 1.5rem;
  padding: 1.25rem 0 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 12px;
  background: linear-gradient(145deg, #1d2226, #0f1214);
  border: 1px solid var(--line-strong);
  color: var(--accent);
  flex: none;
  box-shadow: inset 0 0 0 1px rgba(200, 255, 46, 0.08), 0 0 24px -6px rgba(200, 255, 46, 0.45);
}

.brand-mark svg { display: block; filter: drop-shadow(0 0 6px rgba(200, 255, 46, 0.6)); }

.brand-copy { min-width: 0; }

.brand-copy h1,
.topbar h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.32rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.05;
}

.brand-copy .kicker { margin-top: 0.22rem; letter-spacing: 0.22em; }

.pulse {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.45rem 0.85rem 0.45rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(19, 22, 25, 0.6);
}

.pulse:empty { display: none; }

.pulse-copy { display: flex; flex-direction: column; line-height: 1.05; }

.pulse-copy b {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.pulse-copy span {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.pulse-ticks { display: flex; gap: 0.38rem; align-items: flex-end; }

.pulse-tick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.22rem;
}

.pulse-tick i {
  display: block;
  width: 0.42rem;
  height: 1.35rem;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.09);
}

.pulse-tick.is-on i {
  background: linear-gradient(180deg, #e4ff8f, var(--accent));
  box-shadow: 0 0 12px rgba(200, 255, 46, 0.55);
}

.pulse-tick.is-today i { outline: 1px solid rgba(255, 255, 255, 0.45); outline-offset: 2px; }

.pulse-tick small {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--faint);
  text-transform: uppercase;
}

.pulse-tick.is-today small { color: var(--ink-2); }

.topbar-actions,
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.65rem;
  align-items: center;
  justify-content: flex-end;
}

.topbar-actions .meta { margin: 0; font-family: var(--font-mono); font-size: 0.74rem; }

/* ---------- Панель разделов / фильтры / поиск ---------- */

.toolbar {
  position: sticky;
  top: 0.6rem;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  padding: 0.4rem;
  margin: 0 0 0.6rem;
  background: rgba(14, 16, 19, 0.78);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
}

.cluster,
.nav-seg,
.filter-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  padding: 0.2rem;
  border-radius: 12px;
}

.filter-seg:not(:empty) {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

.toolbar button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--muted);
  transition: color 0.18s ease, background 0.18s ease;
}

.toolbar button:hover { color: var(--ink); background: rgba(255, 255, 255, 0.04); }

.nav-seg button { position: relative; }

.nav-icon { width: 1.1rem; height: 1.1rem; flex: none; }

.nav-short { display: none; }

.nav-seg button[aria-pressed="true"] {
  color: var(--ink);
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.nav-seg button[aria-pressed="true"] .nav-icon {
  color: var(--accent);
  filter: drop-shadow(0 0 6px rgba(200, 255, 46, 0.55));
}

.nav-seg button[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0.18rem;
  width: 1.1rem;
  height: 2px;
  border-radius: 2px;
  transform: translateX(-50%);
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.nav-seg button[data-view="live"] { color: var(--accent); }

.nav-seg button[data-view="live"] .nav-icon { animation: beat 1.6s ease-in-out infinite; }

.filter-seg button {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 0.42rem 0.75rem;
}

.filter-seg button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: none;
}

.search { margin-left: auto; position: relative; }

.search::before {
  content: "";
  position: absolute;
  left: 0.8rem;
  top: 50%;
  width: 0.62rem;
  height: 0.62rem;
  border: 1.6px solid var(--muted);
  border-radius: 50%;
  transform: translateY(-62%);
  pointer-events: none;
}

.search::after {
  content: "";
  position: absolute;
  left: 1.36rem;
  top: 50%;
  width: 0.32rem;
  height: 1.6px;
  background: var(--muted);
  transform: translateY(0.18rem) rotate(45deg);
  pointer-events: none;
}

.search input {
  width: 17rem;
  max-width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  border-radius: 10px;
  padding: 0.52rem 0.8rem 0.52rem 2.1rem;
  color: var(--ink);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.search input:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(200, 255, 46, 0.12);
}

.search input::placeholder { color: var(--faint); }

.status {
  margin: 0.4rem 0.2rem 0.75rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
}

/* ---------- Панели ---------- */

.stat,
.catalog-hero,
.catalog-fold,
.exercise-card,
.session,
.empty,
.plan-side,
.rest-timer,
.editor,
.figure-card,
.measure-card,
.home-meta > *,
.stats-card,
.insight-card,
.inbody-card,
.records,
.login-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.022), rgba(255, 255, 255, 0) 120px),
    var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* HUD-уголки на крупных панелях */
.figure-card,
.measure-card,
.stats-card,
.insight-card,
.plan-side,
.inbody-card,
.records,
.catalog-hero,
.login-card,
.home-meta > * {
  position: relative;
}

.insight-card::before,
.insight-card::after,
.figure-card::before,
.measure-card::before,
.stats-card::before,
.plan-side::before,
.inbody-card::before,
.records::before,
.catalog-hero::before,
.login-card::before,
.home-meta > *::before,
.figure-card::after,
.measure-card::after,
.stats-card::after,
.plan-side::after,
.inbody-card::after,
.records::after,
.catalog-hero::after,
.login-card::after,
.home-meta > *::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
  border-color: var(--accent);
  border-style: solid;
  opacity: 0.85;
}

.insight-card::before,
.figure-card::before,
.measure-card::before,
.stats-card::before,
.plan-side::before,
.inbody-card::before,
.records::before,
.catalog-hero::before,
.login-card::before,
.home-meta > *::before {
  top: -1px;
  left: -1px;
  border-width: 1.5px 0 0 1.5px;
  border-top-left-radius: var(--radius);
}

.insight-card::after,
.figure-card::after,
.measure-card::after,
.stats-card::after,
.plan-side::after,
.inbody-card::after,
.records::after,
.catalog-hero::after,
.login-card::after,
.home-meta > *::after {
  right: -1px;
  bottom: -1px;
  border-width: 0 1.5px 1.5px 0;
  border-bottom-right-radius: var(--radius);
}

/* ---------- Сводка ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.9rem;
}

.stat {
  position: relative;
  padding: 0.95rem 1rem 0.9rem;
  overflow: hidden;
}

.stat::after {
  content: "";
  position: absolute;
  right: -30%;
  top: -60%;
  width: 70%;
  height: 120%;
  background: radial-gradient(closest-side, rgba(200, 255, 46, 0.08), transparent);
  pointer-events: none;
}

.stat b {
  display: block;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat span {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-2);
}

.stat small {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.03em;
}

/* ---------- Журнал и каталог ---------- */

.journal, .catalog {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-top: 0.4rem;
}

.journal { gap: 0.55rem; }

.catalog-hero { padding: 1.15rem 1.25rem 1.2rem; }

.catalog-hero h2 { margin: 0.35rem 0 0; font-size: 1.4rem; }

.catalog-hero .note { margin-top: 0.45rem; max-width: 52rem; }

.catalog-tree {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.catalog-fold {
  --stripe: var(--line-strong);
  position: relative;
  overflow: hidden;
}

.catalog-fold::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--stripe);
  box-shadow: 0 0 14px var(--stripe);
  opacity: 0.9;
}

.catalog-fold.region-fold {
  background: var(--bg-2);
  border-color: var(--line);
  box-shadow: none;
}

.catalog-fold.region-fold::before { display: none; }

.catalog-fold-body {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0 0.6rem 0.6rem;
}

.group-fold > .catalog-fold-body { padding: 0 0.7rem 0.7rem 0.9rem; }

.catalog-fold-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.85rem 1rem 0.85rem 1.15rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
  min-height: 3.2rem;
  transition: background 0.18s ease;
}

.catalog-fold-summary:hover { background: rgba(255, 255, 255, 0.02); }

.catalog-fold-summary::-webkit-details-marker { display: none; }
.catalog-fold-summary::marker { content: ""; }

.catalog-fold-summary.level-region { padding: 0.62rem 0.8rem; min-height: 2.75rem; }

.catalog-fold-title {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.level-group .catalog-fold-title { font-size: 1rem; }

.level-region .catalog-fold-title {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--ink-2);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.catalog-fold-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.9rem;
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
}

.catalog-fold-chevron {
  width: 0.5rem;
  height: 0.5rem;
  border-right: 1.6px solid var(--muted);
  border-bottom: 1.6px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.22s var(--ease), border-color 0.18s ease;
  margin: 0 0.25rem;
}

.catalog-fold[open] > .catalog-fold-summary .catalog-fold-chevron {
  transform: translateY(0.14rem) rotate(-135deg);
  border-color: var(--accent);
}

.catalog-fold[open] > .catalog-fold-summary .catalog-fold-count {
  border-color: var(--accent-line);
  color: var(--accent);
}

.catalog-ex-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.catalog-fold[data-group="Грудь"] { --stripe: #ff6b4a; }
.catalog-fold[data-group="Спина"] { --stripe: #4da3ff; }
.catalog-fold[data-group="Ноги"] { --stripe: #4fe3a1; }
.catalog-fold[data-group="Плечи"] { --stripe: #ffc857; }
.catalog-fold[data-group="Руки"] { --stripe: #ff8fb1; }
.catalog-fold[data-group="Пресс"] { --stripe: #c8ff2e; }
.catalog-fold[data-group="Кардио"] { --stripe: #3fe0e6; }
.catalog-fold[data-group="Свой вес"] { --stripe: #a9b6c8; }

.group-title {
  margin: 0.9rem 0 0.1rem;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink-2);
}

.region-title {
  margin: 0.55rem 0 0.05rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Карточка упражнения ---------- */

.exercise-card {
  position: relative;
  overflow: hidden;
  scroll-margin-top: 6rem;
  background: var(--surface-2);
  border-color: var(--line);
  box-shadow: none;
  transition: border-color 0.18s ease;
}

.exercise-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.9rem;
  bottom: 0.9rem;
  width: 2px;
  border-radius: 2px;
  background: var(--focus);
  opacity: 0.85;
}

.exercise-card:hover { border-color: var(--line-strong); }
.exercise-card[open] { border-color: var(--line-strong); background: var(--surface); }

.exercise-card.unused { opacity: 0.9; }
.exercise-card.unused::before { background: var(--faint); }

.exercise-summary {
  display: grid;
  grid-template-columns: 4.4rem minmax(0, 1fr) auto auto;
  gap: 0.55rem 0.85rem;
  align-items: center;
  padding: 0.65rem 0.85rem 0.65rem 0.75rem;
  cursor: pointer;
  list-style: none;
}

.exercise-summary::-webkit-details-marker { display: none; }
.exercise-summary::marker { content: ""; }

.fav-star {
  width: 2.6rem;
  height: 2.6rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--faint);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  flex-shrink: 0;
  transition: color 0.18s ease, transform 0.18s var(--ease), background 0.18s ease, text-shadow 0.18s ease;
}

.fav-star:hover { color: #ffd166; background: rgba(255, 209, 102, 0.08); }

.fav-star.is-on {
  color: #ffd166;
  text-shadow: 0 0 12px rgba(255, 209, 102, 0.65);
  animation: pop 0.35s var(--ease);
}

.fav-star:active { transform: scale(0.88); }

.exercise-thumb {
  width: 4.4rem;
  height: 4.4rem;
  object-fit: cover;
  border-radius: 10px;
  background: var(--plate);
  display: block;
  border: 1px solid var(--line);
}

.exercise-thumb.placeholder {
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-line);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
}

.exercise-summary-copy { min-width: 0; }

.exercise-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.3rem;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tag-pill.group {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}

.tag-pill.muted { background: transparent; }

.exercise-summary h3 {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.exercise-summary .meta { margin: 0.25rem 0 0; font-size: 0.82rem; }

.exercise-card .chevron {
  width: 0.42rem;
  height: 0.42rem;
  border-right: 1.6px solid var(--muted);
  border-bottom: 1.6px solid var(--muted);
  transform: translateY(-0.1rem) rotate(45deg);
  margin-right: 0.25rem;
  transition: transform 0.22s var(--ease);
}

.exercise-card[open] .chevron {
  transform: translateY(0.12rem) rotate(-135deg);
  border-color: var(--accent);
}

.exercise-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--line);
}

.exercise-guide {
  display: grid;
  gap: 0.9rem;
  padding-top: 1rem;
}

.guide-media {
  display: grid;
  grid-template-columns: minmax(150px, 240px) minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
}

.guide-media img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  background: var(--plate);
  border: 1px solid var(--line-strong);
}

.guide-facts { display: grid; gap: 0.5rem; }

.guide-fact {
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}

.guide-fact span {
  display: block;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.guide-fact b {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.3;
}

.guide-summary {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.95rem;
  line-height: 1.55;
}

.guide-block { margin-top: 0.15rem; }

.guide-steps, .guide-tips {
  margin: 0.45rem 0 0;
  padding-left: 1.2rem;
  color: var(--ink);
}

.guide-steps li + li,
.guide-tips li + li { margin-top: 0.38rem; }

.guide-steps li,
.guide-tips li {
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--ink-2);
}

.guide-steps li::marker {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.guide-tips li::marker { color: var(--accent); }

.guide-source {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.guide-source a { color: var(--accent); font-weight: 600; text-decoration: none; }
.guide-source a:hover { text-decoration: underline; }

.exercise-panel {
  margin-top: 1rem;
  padding-top: 0.95rem;
  border-top: 1px dashed var(--line-strong);
}

.exercise-panel .kicker { margin: 0 0 0.4rem; }

/* ---------- Сессия журнала ---------- */

.session {
  position: relative;
  padding: 0;
  overflow: hidden;
  scroll-margin-top: 6rem;
  transition: border-color 0.18s ease;
}

.session::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--focus);
  box-shadow: 0 0 16px var(--focus);
}

.session:hover { border-color: rgba(255, 255, 255, 0.18); }

.session-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1.2rem;
  padding: 0.9rem 1.1rem 0.9rem 1.25rem;
  cursor: pointer;
  list-style: none;
}

.session-toggle::-webkit-details-marker { display: none; }
.session-toggle::marker { content: ""; }

.session-toggle h2 { font-size: 1.05rem; font-weight: 600; }

.session-kind {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  flex: none;
}

.chevron {
  width: 0.42rem;
  height: 0.42rem;
  border-right: 1.6px solid var(--muted);
  border-bottom: 1.6px solid var(--muted);
  transform: translateY(-0.1rem) rotate(45deg);
  transition: transform 0.22s var(--ease);
}

.session[open] .chevron {
  transform: translateY(0.12rem) rotate(-135deg);
  border-color: var(--accent);
}

.session-body { padding: 0 1.1rem 1.05rem 1.25rem; }

.session[data-focus="legs"] { --focus: #4fe3a1; }
.session[data-focus="push"] { --focus: #ff6b4a; }
.session[data-focus="pull"] { --focus: #4da3ff; }
.session[data-focus="mixed"] { --focus: #ffc857; }

.exercise-card[data-group="Грудь"] { --focus: #ff6b4a; }
.exercise-card[data-group="Спина"] { --focus: #4da3ff; }
.exercise-card[data-group="Ноги"] { --focus: #4fe3a1; }
.exercise-card[data-group="Плечи"] { --focus: #ffc857; }
.exercise-card[data-group="Руки"] { --focus: #ff8fb1; }
.exercise-card[data-group="Пресс"] { --focus: #c8ff2e; }
.exercise-card[data-group="Кардио"] { --focus: #3fe0e6; }
.exercise-card[data-group="Свой вес"] { --focus: #a9b6c8; }

.session-head, .exercise-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.session-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
}

.warning {
  margin: 0.75rem 0 0;
  padding: 0.6rem 0.8rem;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: var(--radius-sm);
  color: #ffd59a;
  font-size: 0.86rem;
}

.block + .block {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.block h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.005em;
}

.block.cue {
  padding: 0.75rem 0.85rem;
  background: var(--accent-soft);
  border: 1px dashed var(--accent-line);
  border-radius: var(--radius-sm);
}

.kicker-mini {
  margin: 0 0 0.25rem;
  color: var(--coach);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sets { margin-top: 0.45rem; }

.set {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr) auto auto;
  column-gap: 0.75rem;
  align-items: baseline;
  padding: 0.42rem 0;
  border-top: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.set-index { color: var(--faint); font-family: var(--font-mono); font-size: 0.74rem; }

.reps {
  min-width: 4.5rem;
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink);
}

.tag {
  min-width: 6.8rem;
  text-align: right;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.set-note { margin: 0 0 0.15rem 2.35rem; font-size: 0.8rem; }

.coach {
  margin: 0.7rem 0 0;
  padding-left: 0.75rem;
  border-left: 2px solid var(--coach-line);
  color: #dfff9a;
  font-size: 0.87rem;
}

/* ---------- Графики и таблицы ---------- */

.chart { margin-top: 0.75rem; }

.chart svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
  color: var(--focus);
  font-family: var(--font-mono);
}

.chart .line {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px currentColor);
}

.chart .area { fill: currentColor; fill-opacity: 0.1; stroke: none; }

.chart .dot { fill: var(--surface); stroke: currentColor; stroke-width: 2; }
.chart .dot.peak { fill: currentColor; }
.chart .grid { stroke: rgba(255, 255, 255, 0.08); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .value { fill: var(--ink); font-size: 11px; font-weight: 600; }

.chart-caption {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
}

.table-wrap { overflow-x: auto; margin-top: 0.75rem; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }

th {
  text-align: left;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--muted);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

td, th {
  padding: 0.5rem 0.45rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

td.num, th.num { text-align: right; }
td.num { font-family: var(--font-mono); font-size: 0.86rem; }

tr.is-peak { background: var(--peak); }
tr.is-peak td:first-child { box-shadow: inset 2px 0 0 var(--accent); }

.best {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem;
}

.bar {
  display: block;
  width: 5.5rem;
  height: 0.32rem;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 99px;
  overflow: hidden;
  flex: none;
}

.bar i {
  display: block;
  height: 100%;
  width: var(--w);
  background: var(--focus, var(--accent));
  border-radius: 99px;
  box-shadow: 0 0 8px var(--focus, var(--accent));
}

.incomplete {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
}

.empty {
  margin: 1.25rem 0;
  padding: 1.1rem 1.2rem;
}

.empty button {
  margin-top: 0.7rem;
  border: 0;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 10px;
  padding: 0.5rem 0.95rem;
  cursor: pointer;
  font-weight: 700;
}

/* ---------- Подвал ---------- */

.foot {
  margin-top: 2.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
}

.foot summary {
  cursor: pointer;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.foot ol { margin: 0.7rem 0 0; padding-left: 1.2rem; }
.foot li + li { margin-top: 0.35rem; }
.source { margin: 0.8rem 0 0; font-family: var(--font-mono); font-size: 0.7rem; color: var(--faint); }

/* ---------- Кнопки ---------- */

.primary, .quiet, .tiny {
  font: inherit;
  cursor: pointer;
  border-radius: 10px;
  font-weight: 600;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}

.primary:active, .quiet:active, .tiny:active { transform: translateY(1px) scale(0.985); }

.primary {
  position: relative;
  border: 0;
  background: var(--accent);
  color: var(--on-accent);
  padding: 0.62rem 1.15rem;
  font-weight: 700;
  letter-spacing: 0.005em;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%);
}

.primary:hover { background: #d8ff66; }

.quiet, .tiny {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.025);
  color: var(--ink);
}

.quiet:hover, .tiny:hover {
  border-color: var(--accent-line);
  background: rgba(200, 255, 46, 0.05);
}

.quiet { padding: 0.5rem 0.85rem; }

.tiny {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 500;
}

button.quiet[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-line);
}

button:disabled {
  opacity: 0.35;
  cursor: default;
}

button:disabled:active { transform: none; }

[data-act="logout"] {
  color: var(--muted);
  border-color: var(--line);
  background: transparent;
}

/* ---------- Сборка тренировки ---------- */

.plan {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(20rem, 0.9fr);
  gap: 1.1rem;
  align-items: start;
  margin-top: 0.35rem;
}

.plan-main { min-width: 0; }

.plan-tree { margin-top: 0.35rem; }

.plan-empty {
  margin: 0.5rem 0 1rem;
  padding: 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-2);
}

.plan-ex-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.plan-ex-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
  width: 100%;
  min-height: 3.2rem;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 11px;
  padding: 0.65rem 0.8rem;
  cursor: pointer;
  color: inherit;
  font: inherit;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.plan-ex-row:hover { border-color: var(--line-strong); background: var(--surface-3); }

.plan-ex-row.is-on {
  border-color: var(--accent-line);
  background: linear-gradient(90deg, rgba(200, 255, 46, 0.1), rgba(200, 255, 46, 0.02));
  box-shadow: inset 2px 0 0 var(--accent);
}

.plan-ex-row.is-taken { opacity: 0.5; cursor: default; }

.plan-ex-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.plan-ex-copy strong { font-weight: 700; font-size: 0.94rem; line-height: 1.25; }

.plan-ex-meta {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.35;
}

.plan-ex-mark {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.2s var(--ease);
}

.plan-ex-row.is-on .plan-ex-mark {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 0 14px rgba(200, 255, 46, 0.55);
}

.picker-filters { margin: 0.55rem 0 0.75rem; }

.plan-side {
  position: sticky;
  top: 5.2rem;
  padding: 1.05rem 1.1rem 1.1rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.plan-side h2 { font-size: 1.15rem; }

.templates, .pick, .row-actions, .confirm-actions, .live-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.group-label {
  margin: 1rem 0 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.region-label {
  margin: 0.55rem 0 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-2);
}

.picked {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0.8rem 0 1rem;
  counter-reset: picked;
}

.picked-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: flex-start;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}

.picked-row strong { font-weight: 700; }
.picked-row .caption { margin-top: 0.15rem; font-family: var(--font-mono); font-size: 0.7rem; }

.custom-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
}

.custom-row input, .custom-row select, .field input, .field select {
  font: inherit;
  color: var(--ink);
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.65rem;
  min-height: 2.6rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.custom-row input:focus, .custom-row select:focus, .field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(200, 255, 46, 0.12);
}

.custom-row input { min-width: 12rem; flex: 1; }

select option { background: var(--surface-2); color: var(--ink); }

/* ---------- Активная тренировка ---------- */

.live-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
  margin: 0.2rem 0 1rem;
}

.rest-timer {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1rem;
  padding: 0.95rem 1.1rem;
  overflow: hidden;
}

.rest-timer::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--faint);
}

.rest-timer[data-running="true"] { border-color: var(--accent-line); }

.rest-timer[data-running="true"]::before {
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent);
}

.rest-timer[data-running="true"] b { color: var(--accent); text-shadow: 0 0 18px rgba(200, 255, 46, 0.45); }

.rest-copy .kicker { margin: 0; }

.rest-timer b {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--font-mono);
  font-size: 2.3rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.rest-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
}

.rest-timer { flex-wrap: wrap; row-gap: 0.65rem; }

.rest-bar {
  flex: 1 0 100%;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.rest-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--faint);
  transition: width 0.25s linear;
}

.rest-timer[data-running="true"] .rest-bar i { background: var(--accent); box-shadow: 0 0 10px var(--accent); }

.rest-presets { flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.rest-presets .tiny { font-family: var(--font-mono); font-size: 0.74rem; }

.rest-timer[data-done="true"] { border-color: rgba(255, 107, 74, 0.6); }
.rest-timer[data-done="true"]::before { background: #ff6b4a; box-shadow: 0 0 16px #ff6b4a; }
.rest-timer[data-done="true"] b { color: #ff8a6b; text-shadow: 0 0 18px rgba(255, 107, 74, 0.5); }
.rest-timer[data-done="true"][data-running="true"] b { animation: beat 1s ease-in-out infinite; }
.rest-timer[data-done="true"] .rest-bar i { background: #ff6b4a; box-shadow: 0 0 10px #ff6b4a; }
.rest-timer[data-done="true"] .kicker { color: #ff8a6b; }
.rest-timer[data-done="true"] .kicker::before { background: #ff6b4a; box-shadow: 0 0 10px #ff6b4a; }

.live-sticky {
  position: sticky;
  top: 0.55rem;
  z-index: 8;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.15rem;
  background: linear-gradient(180deg, var(--bg) 70%, transparent);
}

.live-sticky .live-head,
.live-sticky .rest-timer {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(19, 22, 25, 0.92);
}

.live-progress {
  margin: 0 0 0.65rem;
  color: var(--muted);
}

.editor {
  position: relative;
  padding: 1rem 1.1rem 0.85rem 1.25rem;
  margin-bottom: 0.8rem;
  overflow: hidden;
}

.editor.is-active-entry {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 1px rgba(200, 255, 46, 0.12), 0 12px 32px -18px rgba(0, 0, 0, 0.55);
}

.editor.is-collapsed {
  padding: 0;
  margin-bottom: 0.45rem;
}

.editor.is-collapsed::before {
  opacity: 0.35;
  width: 2px;
}

.collapsed-toggle {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.7rem 0.9rem 0.7rem 1rem;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.collapsed-toggle:hover {
  background: rgba(255, 255, 255, 0.03);
}

.collapsed-mark {
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(200, 255, 46, 0.14);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
}

.collapsed-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.collapsed-text b {
  font-size: 0.95rem;
  font-weight: 600;
}

.collapsed-text .caption {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collapsed-action {
  font-size: 0.78rem;
  color: var(--muted);
}

.undo-toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  max-width: calc(100vw - 1.5rem);
  padding: 0.75rem 0.85rem 0.75rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(19, 22, 25, 0.96);
  box-shadow: 0 18px 48px -20px rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.undo-toast[hidden] { display: none; }

.undo-toast p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.undo-toast .primary {
  flex: 0 0 auto;
  min-height: 2.35rem;
  padding: 0.45rem 0.85rem;
}

.weight-stats-card .trend-line {
  margin-top: 0.45rem;
}

.weight-stats-card .stats-chart {
  margin-top: 0.2rem;
}

.editor::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--focus);
  box-shadow: 0 0 16px var(--focus);
}

.live[data-focus="push"], .editor[data-focus="push"] { --focus: #ff6b4a; }
.live[data-focus="pull"], .editor[data-focus="pull"] { --focus: #4da3ff; }
.live[data-focus="legs"], .editor[data-focus="legs"] { --focus: #4fe3a1; }
.live[data-focus="mixed"], .editor[data-focus="mixed"] { --focus: #ffc857; }

.editor-sets { margin-top: 0.4rem; }

.editor-set {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
  padding: 0.6rem 0;
  border-top: 1px solid var(--line);
  transition: background 0.2s ease;
}

.editor-set .field { width: 7.5rem; }
.editor-set .rir-field, .editor-set .rir-gap { width: 6rem; }
.editor-set .check { margin-right: 0.2rem; }
.editor-set .tiny { min-height: 2.6rem; }

.editor-set.is-warmup .field input { color: var(--muted); }

.editor-set.is-done {
  background: linear-gradient(90deg, rgba(200, 255, 46, 0.06), transparent 70%);
}

.set-done {
  min-height: 2.6rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--accent-line);
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.set-done:hover { background: var(--accent-soft); }

.set-done.is-done {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 0 18px -4px rgba(200, 255, 46, 0.7);
  animation: pop 0.3s var(--ease);
}

/* ---------- Подсказки и инструменты в упражнении ---------- */

.coach-hint {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin: 0.55rem 0 0.35rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
}

.coach-hint p { margin: 0; flex: 1 1 14rem; font-size: 0.88rem; color: var(--ink-2); }

.coach-hint-mark {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.3rem;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
}

.coach-hint.hint-hold { border-color: var(--warn-line); background: var(--warn-bg); }
.coach-hint.hint-hold .coach-hint-mark { background: var(--warn); }
.coach-hint.hint-reps { border-color: rgba(77, 163, 255, 0.4); background: rgba(77, 163, 255, 0.07); }
.coach-hint.hint-reps .coach-hint-mark { background: #4da3ff; }

.entry-tools-wrap { margin: 0.35rem 0 0.2rem; }

.entry-tools { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.entry-tools .tiny[aria-pressed="true"] {
  border-color: var(--accent-line);
  color: var(--accent);
  background: var(--accent-soft);
}

.plate-panel {
  margin-top: 0.5rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}

.plate-panel .note { margin: 0; }

.plate-head { display: flex; align-items: baseline; gap: 0.6rem; }
.plate-head b { font-family: var(--font-mono); font-size: 1.15rem; }
.plate-head span { color: var(--muted); font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.05em; }

.plate-viz {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 5.2rem;
  margin: 0.55rem 0 0.35rem;
  overflow-x: auto;
}

.plate-sleeve {
  flex: none;
  width: 2.2rem;
  height: 0.7rem;
  border-radius: 2px 0 0 2px;
  background: linear-gradient(180deg, #d6dbe0, #7c848c);
}

.plate-collar {
  flex: none;
  width: 0.5rem;
  height: 1.5rem;
  border-radius: 2px;
  background: linear-gradient(180deg, #e2e6ea, #8a9298);
}

.plate-collar::after {
  content: "";
  display: block;
  width: 3rem;
  height: 0.7rem;
  margin: 0.4rem 0 0 0.5rem;
  border-radius: 0 2px 2px 0;
  background: linear-gradient(180deg, #d6dbe0, #7c848c);
}

.plate {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.15rem;
  border-radius: 3px;
  color: rgba(0, 0, 0, 0.75);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  font-weight: 700;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25), inset 2px 0 0 rgba(255, 255, 255, 0.25);
  animation: tint-in 0.35s var(--ease) both;
}

.plate.p25 { height: 5rem; background: #e5383b; }
.plate.p20 { height: 5rem; background: #3a86ff; }
.plate.p15 { height: 4.4rem; background: #ffd23f; }
.plate.p10 { height: 3.8rem; background: #2ec27e; }
.plate.p5 { height: 3rem; width: 0.95rem; background: #eceff1; }
.plate.p2_5 { height: 2.4rem; width: 0.8rem; background: #3c4248; color: #eceff1; }
.plate.p1_25 { height: 2rem; width: 0.7rem; background: #aab3bb; font-size: 0.5rem; }

.plate-text { margin: 0 0 0.5rem; font-size: 0.86rem; color: var(--ink-2); }

.plate-panel .templates { margin: 0; }

.plate-panel .tiny[aria-pressed="true"],
.rest-presets .tiny[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

/* ---------- Главная ---------- */

section.home {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
  width: 100%;
  margin-top: 0.25rem;
}

.figure-card, .measure-card { min-width: 0; }

.figure-card {
  padding: 0.8rem;
  position: sticky;
  top: 5.2rem;
}

.muscle-map {
  position: relative;
  isolation: isolate;
  border-radius: 10px;
  overflow: hidden;
  background-color: #0c0f11;
  background-image:
    radial-gradient(60% 55% at 28% 48%, rgba(200, 255, 46, 0.07), transparent 70%),
    radial-gradient(60% 55% at 72% 48%, rgba(77, 163, 255, 0.07), transparent 70%),
    linear-gradient(rgba(200, 255, 46, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(200, 255, 46, 0.05) 1px, transparent 1px);
  background-size: auto, auto, 28px 28px, 28px 28px;
  background-position: center, center, center, center;
  box-shadow: inset 0 0 0 1px rgba(200, 255, 46, 0.12), inset 0 0 80px rgba(0, 0, 0, 0.75);
}

.muscle-map img,
.muscle-map .muscle-base {
  width: 100%;
  height: auto;
  display: block;
}

.muscle-map .muscle-base {
  filter:
    drop-shadow(0 0 0.6px rgba(255, 255, 255, 0.55))
    drop-shadow(0 0 10px rgba(200, 255, 46, 0.14));
}

.muscle-map::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -35%;
  height: 35%;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(200, 255, 46, 0), rgba(200, 255, 46, 0.08) 80%, rgba(200, 255, 46, 0.6) 99%, rgba(200, 255, 46, 0));
  animation: scan 1.25s var(--ease) 0.1s 1 both;
  z-index: 2;
}

.muscle-tint {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: multiply;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  animation: tint-in 0.6s var(--ease) both;
}

.muscle-tint.lv-primary { background: #ff2a22; }
.muscle-tint.lv-secondary { background: #ffc21a; animation-delay: 0.08s; }
.muscle-tint.lv-assist { background: #3d8fff; animation-delay: 0.16s; }
.muscle-tint.rc-tired { background: #ff2a22; }
.muscle-tint.rc-mid { background: #ffc21a; }
.muscle-tint.rc-ready { background: #3ee08a; }
.muscle-tint.rc-stale { background: #3d8fff; opacity: 0.75; }

.map-mode { align-self: flex-start; }

.map-mode button {
  border: 0;
  background: transparent;
  border-radius: 10px;
  color: var(--muted);
  cursor: pointer;
}

.map-mode button:hover { color: var(--ink); }

.figure-caption {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-align: center;
}

.home-muscle {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.home-muscle .muscle-legend { margin: 0.1rem 0 0; }
.home-muscle .muscle-chips { margin-top: 0; }

.plan-muscle {
  margin-bottom: 0.9rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}

.plan-muscle h3 {
  margin: 0.35rem 0 0.6rem;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
}

.plan-muscle-map { margin-bottom: 0.6rem; }

.muscle-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin: 0.4rem 0 0.5rem;
}

.muscle-legend-item {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.03em;
  color: var(--muted);
  padding-left: 0.85rem;
  position: relative;
}

.muscle-legend-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.32em;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 2px;
}

.muscle-legend-item.lv-primary::before { background: #ff3b30; box-shadow: 0 0 8px #ff3b30; }
.muscle-legend-item.lv-secondary::before { background: #ffc21a; box-shadow: 0 0 8px #ffc21a; }
.muscle-legend-item.lv-assist::before { background: #3d8fff; box-shadow: 0 0 8px #3d8fff; }
.muscle-legend-item.rc-tired::before { background: #ff3b30; box-shadow: 0 0 8px #ff3b30; }
.muscle-legend-item.rc-mid::before { background: #ffc21a; box-shadow: 0 0 8px #ffc21a; }
.muscle-legend-item.rc-ready::before { background: #3ee08a; box-shadow: 0 0 8px #3ee08a; }
.muscle-legend-item.rc-stale::before { background: #3d8fff; box-shadow: 0 0 8px #3d8fff; }

.muscle-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.muscle-chip {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
}

.muscle-chip.lv-primary {
  background: rgba(255, 59, 48, 0.13);
  border-color: rgba(255, 59, 48, 0.45);
  color: #ff9a92;
}

.muscle-chip.lv-secondary {
  background: rgba(255, 194, 26, 0.12);
  border-color: rgba(255, 194, 26, 0.42);
  color: #ffd866;
}

.muscle-chip.lv-assist {
  background: rgba(61, 143, 255, 0.13);
  border-color: rgba(61, 143, 255, 0.42);
  color: #8fbcff;
}

.muscle-chip.rc-tired { background: rgba(255, 59, 48, 0.13); border-color: rgba(255, 59, 48, 0.45); color: #ff9a92; }
.muscle-chip.rc-mid { background: rgba(255, 194, 26, 0.12); border-color: rgba(255, 194, 26, 0.42); color: #ffd866; }
.muscle-chip.rc-ready { background: rgba(62, 224, 138, 0.11); border-color: rgba(62, 224, 138, 0.4); color: #8af0bb; }

.muscle-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.measure-card {
  padding: 1.15rem 1.25rem 1.2rem;
  display: flex;
  flex-direction: column;
}

.measure-card h2 { margin-top: 0.35rem; font-size: 1.4rem; }

.measure-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin-top: 0.85rem;
}

.bmi {
  margin: 0.95rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.bmi b {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-right: 0.25rem;
}

.weight-tracker {
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.weight-tracker .chart { margin-top: 0.5rem; --focus: var(--accent); }

.weight-week-list {
  list-style: none;
  margin: 0.7rem 0 0.8rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.3rem 1rem;
}

.weight-week-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.22rem 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.82rem;
  color: var(--muted);
}

.weight-week-list b {
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.weight-log-btn { width: 100%; min-height: 2.9rem; }

.muscle-sets {
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.muscle-list {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.4rem 1.1rem;
}

.muscle-list li {
  display: grid;
  grid-template-columns: 0.6rem minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}

.muscle-list .swatch {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 2px;
}

.muscle-list b { font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.muscle-list li[data-empty="true"] { color: var(--faint); }
.muscle-list li[data-empty="true"] .swatch { opacity: 0.25; box-shadow: none; }

.home-stack {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  width: 100%;
}

.home-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
  width: 100%;
}

.home-meta > * {
  padding: 1.1rem 1.2rem;
  margin-top: 0;
  min-width: 0;
}

.home-meta .latest,
.home-meta .inbody-summary {
  margin-top: 0;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line-strong);
}

.home-meta .latest-line { margin-bottom: 0.75rem; }

.latest {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.latest-line {
  margin: 0.4rem 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

body.home-page .lede { display: none; }

/* ---------- Статистика ---------- */

.stats-page { margin-top: 0.25rem; }

.stats-hero h2 { margin: 0.35rem 0 0; font-size: 1.4rem; }

.stats-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.65rem;
  margin: 0.95rem 0 0.8rem;
}

.stats-kpi .stat { padding: 0.85rem 0.95rem; }

.stats-highlight {
  margin: 0 0 0.9rem;
  padding: 0.75rem 0.95rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-sm);
  color: #e3ff9c;
  font-size: 0.9rem;
  line-height: 1.45;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.stats-grid.tables { margin-top: 0.9rem; }

.stats-card { padding: 1.05rem 1.1rem 1.1rem; min-width: 0; }

.stats-card.wide { grid-column: 1 / -1; }

.stats-card h3 {
  margin: 0.35rem 0 0.6rem;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
}

.stats-chart { margin-top: 0.35rem; }

.hbar-chart {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.hbar-row {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
}

.hbar-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hbar-track {
  height: 0.5rem;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 99px;
  overflow: hidden;
}

.hbar-track i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  box-shadow: 0 0 10px rgba(200, 255, 46, 0.4);
  transform-origin: left center;
  animation: grow 0.8s var(--ease) both;
}

.hbar-value {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stats-table-wrap { overflow-x: auto; margin-top: 0.35rem; }

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.stats-table th,
.stats-table td {
  padding: 0.5rem 0.45rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.86rem;
  vertical-align: top;
}

.stats-table thead th {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.stats-table tbody th { font-weight: 600; color: var(--ink); }

.stats-table tbody tr { transition: background 0.15s ease; }
.stats-table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }

/* ---------- Состав тела ---------- */

.inbody-page { margin-top: 0.25rem; }

.inbody-page > h2 { margin: 0.35rem 0 0; font-size: 1.4rem; }

.inbody-card {
  padding: 1.15rem 1.25rem 1.2rem;
  margin-top: 0.9rem;
}

.inbody-card h2 { margin: 0.35rem 0 0; font-size: 1.2rem; }

.inbody-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.65rem;
  margin-top: 0.95rem;
}

.inbody-metric {
  padding: 0.8rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}

.inbody-metric b {
  display: block;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}

.inbody-metric span {
  display: block;
  margin-top: 0.4rem;
  color: var(--ink-2);
  font-size: 0.8rem;
}

.inbody-metric small {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.64rem;
}

.segment-block { margin-top: 1.1rem; }

.segment-row {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  margin-top: 0.5rem;
}

.segment-name { color: var(--ink-2); font-size: 0.82rem; }

.segment-track {
  height: 0.45rem;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 99px;
  overflow: hidden;
}

.segment-track i {
  display: block;
  width: var(--w);
  height: 100%;
  background: #4da3ff;
  border-radius: 99px;
  box-shadow: 0 0 10px rgba(77, 163, 255, 0.5);
  transform-origin: left center;
  animation: grow 0.8s var(--ease) both;
}

.segment-track i.fat { background: #ff6b4a; box-shadow: 0 0 10px rgba(255, 107, 74, 0.5); }

.segment-value {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.inbody-summary .latest-line { font-size: 1.15rem; }

/* ---------- Рекорды ---------- */

.records { padding: 1.15rem 1.25rem 1.2rem; }

.records h2 { margin: 0.35rem 0 0; font-size: 1.3rem; }

.record-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 0.65rem;
  margin-top: 0.95rem;
}

.record {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.7rem;
  min-height: 7.2rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
  transition: border-color 0.18s ease, transform 0.18s var(--ease);
}

.record::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 70%);
  opacity: 0.6;
}

.record:hover { border-color: var(--line-strong); transform: translateY(-2px); }

.record.is-fresh { border-color: var(--accent-line); background: linear-gradient(160deg, rgba(200, 255, 46, 0.08), var(--surface-2) 60%); }
.record.is-fresh::before { opacity: 1; box-shadow: 0 0 12px var(--accent); }

.record h3 {
  margin: 0.2rem 0 0;
  font-family: var(--font-body);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.2;
}

.record-score {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 0.6rem;
}

.record-score b {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--accent);
}

/* ---------- Прочее ---------- */

.figure {
  width: 100%;
  height: auto;
  display: block;
  color: var(--ink);
}

.figure path { fill: currentColor; }
.figure line { stroke: var(--muted); stroke-width: 1.25; }

.figure text {
  fill: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.field input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}

.field select { text-transform: none; letter-spacing: 0; font-family: var(--font-body); font-size: 0.92rem; }

input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { opacity: 0.4; }

input[type="checkbox"] { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; }

.edit-date { max-width: 14rem; margin-top: 0.7rem; }

.check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.7rem;
  font-size: 0.85rem;
}

.confirm {
  margin: 0.7rem 0;
  padding: 0.75rem 0.85rem;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: var(--radius-sm);
}

.confirm p { margin: 0 0 0.6rem; }

body.training .topbar { padding: 0.95rem 0 0.7rem; }
body.training .lede { display: none; }

/* ---------- Инсайты: сегодня и цели ---------- */

.home-insights {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.1rem;
  margin: 1.1rem 0;
}

.insight-card {
  padding: 1.1rem 1.2rem 1.15rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.insight-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.insight-card .note { margin: 0; }
.insight-card > .primary, .insight-card > .tiny { align-self: flex-start; }
.insight-card .caption { margin: 0.2rem 0 0; }

.today-card {
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(200, 255, 46, 0.07), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.022), rgba(255, 255, 255, 0) 120px),
    var(--surface);
}

.today-tired { margin: 0; font-size: 0.82rem; color: #ff9a92; }

.today-scores { display: grid; gap: 0.4rem; margin: 0.2rem 0; }

.today-score {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 0.6rem;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--muted);
}

.today-score.is-best { color: var(--ink); }

.today-tip {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-top: 0.3rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--warn-line);
  background: var(--warn-bg);
  font-size: 0.84rem;
}

.today-tip strong { color: var(--warn); font-size: 0.82rem; }
.today-tip span { color: var(--ink-2); }

.goal-list { display: grid; gap: 0.85rem; margin: 0.15rem 0 0.35rem; }

.goal-row { display: grid; gap: 0.35rem; }

.goal-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.6rem;
  font-size: 0.9rem;
}

.goal-head span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goal-head b { flex: none; font-family: var(--font-mono); font-size: 0.9rem; color: var(--accent); }

.goal-sub { margin: 0; font-size: 0.78rem; color: var(--muted); }

.goal-bar {
  height: 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.goal-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(200, 255, 46, 0.45), var(--accent));
  transform-origin: left;
  animation: grow 0.8s var(--ease) both;
}

.goal-bar.is-good i { box-shadow: 0 0 12px rgba(200, 255, 46, 0.6); }

.goal-segments { display: flex; gap: 4px; }

.goal-segments i {
  flex: 1;
  height: 8px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.07);
}

.goal-segments i.is-on {
  background: var(--accent);
  box-shadow: 0 0 10px rgba(200, 255, 46, 0.5);
  animation: pop 0.35s var(--ease) both;
}

.goals-form { display: grid; gap: 0.65rem; }
.goals-form .group-label { margin: 0.3rem 0 0; }

.goals-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.goal-lift-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 6rem 5rem auto;
  gap: 0.5rem;
  align-items: end;
}

.goal-lift-row .tiny { min-height: 2.6rem; }
.goals-form > .tiny { justify-self: start; }
.goals-form .confirm-actions { margin-top: 0.2rem; }

.pulse.is-met .pulse-copy b { color: var(--accent); text-shadow: 0 0 14px rgba(200, 255, 46, 0.5); }

/* ---------- Сила, застой, прогноз ---------- */

.strength-grid {
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  margin-bottom: 0.9rem;
}

.strength-grid .stats-card.wide { grid-column: auto; }

.strength-list { display: grid; margin-top: 0.5rem; }

.strength-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7.5rem 4.6rem 3.6rem 6.2rem;
  gap: 0.75rem;
  align-items: center;
  padding: 0.55rem 0;
  border-top: 1px solid var(--line);
}

.strength-name { min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.strength-name strong { font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strength-name span { font-family: var(--font-mono); font-size: 0.66rem; color: var(--muted); }

.mini-spark { width: 100%; height: 2.1rem; overflow: visible; }

.mini-spark path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
  filter: drop-shadow(0 0 4px rgba(200, 255, 46, 0.45));
}

.strength-value { font-family: var(--font-mono); font-size: 0.98rem; text-align: right; }

.strength-change { font-family: var(--font-mono); font-size: 0.76rem; text-align: right; color: var(--muted); }
.strength-change.is-up { color: var(--accent); }
.strength-change.is-down { color: #ff8a6b; }

.st-pill {
  justify-self: end;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  color: var(--muted);
}

.st-pill.st-up { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.st-pill.st-plateau { color: var(--warn); border-color: var(--warn-line); background: var(--warn-bg); }
.st-pill.st-down { color: #ff8a6b; border-color: rgba(255, 107, 74, 0.45); background: rgba(255, 107, 74, 0.08); }

.advice-list { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.55rem; }

.advice {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--warn-line);
  border-left-width: 3px;
  background: var(--warn-bg);
  font-size: 0.86rem;
  color: var(--ink-2);
}

.advice.st-down { border-color: rgba(255, 107, 74, 0.45); background: rgba(255, 107, 74, 0.07); }
.advice strong { color: var(--ink); }
.advice-meta { font-family: var(--font-mono); font-size: 0.68rem; color: var(--muted); }

.trend-line { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0 0.2rem; }
.trend-line.muted { color: var(--muted); font-size: 0.8rem; }

.trend-chip {
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.76rem;
  color: var(--muted);
}

.trend-chip b { font-family: var(--font-mono); color: var(--ink); font-weight: 600; }
.trend-chip.is-down b { color: #4fe3a1; }
.trend-chip.is-up b { color: #ffc857; }
.trend-chip.is-good { border-color: var(--accent-line); background: var(--accent-soft); }
.trend-chip.is-good b { color: var(--accent); }
.trend-chip.is-warn { border-color: var(--warn-line); background: var(--warn-bg); }
.trend-chip.is-warn b { color: var(--warn); }

.weight-duo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.4rem;
  align-items: start;
}

.weight-duo-col { min-width: 0; }
.weight-duo-col .group-label { margin-top: 0.5rem; }

.forecast-chart { color: var(--accent); }
.forecast-svg .band { fill: rgba(200, 255, 46, 0.09); stroke: none; }
.forecast-svg .projection { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 6 6; opacity: 0.85; }
.forecast-svg .goal-line { stroke: #4da3ff; stroke-width: 1.3; stroke-dasharray: 2 5; }
.forecast-svg .goal-label { fill: #8fbcff; font-family: var(--font-mono); font-size: 11px; }
.forecast-svg .today-line { stroke: rgba(255, 255, 255, 0.25); stroke-width: 1; }
.forecast-svg .line { filter: drop-shadow(0 0 4px rgba(200, 255, 46, 0.5)); }

/* ---------- Движение ---------- */

#content.is-entering > * > * {
  animation: rise 0.5s var(--ease) both;
}

#content.is-entering > * > *:nth-child(2) { animation-delay: 0.05s; }
#content.is-entering > * > *:nth-child(3) { animation-delay: 0.1s; }
#content.is-entering > * > *:nth-child(4) { animation-delay: 0.15s; }
#content.is-entering > * > *:nth-child(n + 5) { animation-delay: 0.2s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes scan {
  from { top: -35%; opacity: 1; }
  85% { opacity: 1; }
  to { top: 100%; opacity: 0; }
}

@keyframes tint-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes grow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes pop {
  0% { transform: scale(0.7); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

@keyframes beat {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .muscle-map::after { display: none; }
}

/* ---------- Широкие экраны: больше на одном экране ---------- */

@media (min-width: 1280px) {
  .catalog-ex-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(30rem, 1fr));
    align-items: start;
  }

  .plan-ex-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
    align-items: stretch;
  }

  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(30rem, 1fr)); }
}

@media (min-width: 1500px) {
  .journal {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  section.home { grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); }
}

/* ---------- Планшет ---------- */

@media (max-width: 1000px) {
  .topbar { grid-template-columns: auto auto; }
  .pulse { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; justify-content: space-between; }
  .topbar-actions { grid-column: 2; grid-row: 1; }
  .plan { grid-template-columns: 1fr; }
  .plan-side { position: static; max-height: none; overflow: visible; }
  section.home { grid-template-columns: 1fr; }
  .strength-grid { grid-template-columns: 1fr; }
  .weight-duo { grid-template-columns: 1fr; gap: 0.4rem; }
  .figure-card { position: static; }
  .figure-card .muscle-map { max-width: 40rem; margin: 0 auto; }
}

/* ---------- Мобильная версия: нижний док ---------- */

@media (max-width: 760px) {
  body { font-size: 15px; background-attachment: scroll; }

  .app {
    width: calc(100% - 1.25rem);
    padding-bottom: calc(6.6rem + env(safe-area-inset-bottom));
  }

  .topbar {
    padding: calc(0.8rem + env(safe-area-inset-top)) 0 0.7rem;
    gap: 0.7rem;
  }

  .brand-mark { width: 2.3rem; height: 2.3rem; border-radius: 10px; }
  .brand-copy h1 { font-size: 1.12rem; }

  .pulse { padding: 0.45rem 0.75rem; border-radius: 14px; }
  .pulse-ticks { gap: 0.55rem; }
  .pulse-tick i { width: 0.5rem; height: 1.25rem; }

  .brand { gap: 0.6rem; }
  .brand-copy .kicker { white-space: nowrap; letter-spacing: 0.14em; font-size: 0.58rem; }
  .topbar-actions { gap: 0.4rem; flex-wrap: nowrap; }
  .topbar-actions .primary { padding: 0.58rem 0.85rem; font-size: 0.86rem; white-space: nowrap; }
  .topbar-actions .quiet { padding: 0.5rem 0.65rem; font-size: 0.82rem; }
  .topbar-actions .meta { display: none; }

  .toolbar {
    top: 0;
    margin: 0 -0.625rem 0.55rem;
    padding: 0.5rem 0.625rem;
    border-radius: 0;
    border-width: 0 0 1px;
    background: rgba(10, 11, 13, 0.97);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
  }

  .toolbar:not(:has(.filter-seg:not([hidden]))):not(:has(.search:not([hidden]))) {
    padding: 0;
    border: 0;
    margin-bottom: 0;
  }

  .nav-seg {
    position: fixed;
    z-index: 40;
    left: 0.6rem;
    right: 0.6rem;
    bottom: calc(0.6rem + env(safe-area-inset-bottom));
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 0.15rem;
    padding: 0.35rem;
    background: rgba(20, 23, 27, 0.88);
    border: 1px solid var(--line-strong);
    border-radius: 20px;
    box-shadow: 0 -2px 0 rgba(255, 255, 255, 0.02) inset, 0 18px 50px rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
  }

  .nav-seg button {
    flex-direction: column;
    justify-content: center;
    gap: 0.22rem;
    min-height: 3.35rem;
    padding: 0.4rem 0.1rem;
    border-radius: 14px;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.02em;
  }

  .nav-icon { width: 1.35rem; height: 1.35rem; }
  .nav-label { display: none; }
  .nav-short { display: block; white-space: nowrap; }

  .nav-seg button[aria-pressed="true"] {
    color: var(--accent);
    background: rgba(200, 255, 46, 0.08);
    box-shadow: none;
  }

  .nav-seg button[aria-pressed="true"]::after { top: 0.2rem; bottom: auto; }

  .nav-seg button[data-view="live"],
  .nav-seg button[data-view="plan"] {
    color: var(--on-accent);
    background: var(--accent);
    box-shadow: 0 0 20px -4px rgba(200, 255, 46, 0.7);
  }

  .nav-seg button[data-view="live"]::after,
  .nav-seg button[data-view="plan"]::after { display: none; }

  .filter-seg {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    max-width: 100%;
  }

  .filter-seg::-webkit-scrollbar { display: none; }
  .filter-seg button { flex: none; min-height: 2.4rem; }

  .search { margin-left: 0; width: 100%; }
  .search input { width: 100%; min-height: 2.75rem; font-size: 16px; }

  .stats {
    display: flex;
    gap: 0.5rem;
    margin: 0 -0.625rem 0.75rem;
    padding: 0 0.625rem 0.15rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  .stats::-webkit-scrollbar { display: none; }
  .stats .stat { flex: 0 0 9.6rem; scroll-snap-align: start; }
  .stat { padding: 0.8rem 0.85rem; }
  .stat b { font-size: 1.4rem; }

  .session, .exercise-card { scroll-margin-top: 4.5rem; }

  .home-meta { grid-template-columns: 1fr; }
  .home-insights { grid-template-columns: 1fr; gap: 0.75rem; margin: 0.85rem 0 0.75rem; }
  .live-sticky { top: 0.35rem; }
  .undo-toast {
    left: 0.75rem;
    right: 0.75rem;
    bottom: calc(5.4rem + env(safe-area-inset-bottom));
    transform: none;
    max-width: none;
  }
  .undo-toast p { white-space: normal; }
  .insight-card { padding: 1rem; }
  .goals-grid { grid-template-columns: 1fr 1fr; }
  .goals-grid > :first-child { grid-column: 1 / -1; }
  .goal-lift-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .goal-lift-row > :first-child { grid-column: 1 / -1; }
  .strength-row { grid-template-columns: minmax(0, 1fr) 4.2rem auto; gap: 0.2rem 0.6rem; }
  .strength-row .mini-spark { grid-column: 1; grid-row: 2; height: 1.6rem; }
  .strength-row .strength-value { grid-column: 2; grid-row: 1; }
  .strength-row .strength-change { grid-column: 2; grid-row: 2; }
  .strength-row .st-pill { grid-column: 3; grid-row: 1 / span 2; }
  .inbody-grid { grid-template-columns: 1fr 1fr; }
  .segment-row { grid-template-columns: 1fr auto; gap: 0.25rem 0.6rem; }
  .segment-row .segment-track { grid-column: 1 / -1; grid-row: 2; }

  .stats-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-grid { grid-template-columns: 1fr; }
  .hbar-row { grid-template-columns: 4.6rem minmax(0, 1fr) auto; }

  .figure-card { padding: 0.55rem; }
  .measure-card, .records, .inbody-card, .stats-card, .catalog-hero, .home-meta > * { padding: 1rem; }

  .exercise-summary {
    grid-template-columns: 3.5rem minmax(0, 1fr) auto auto;
    gap: 0.45rem 0.6rem;
    padding: 0.55rem 0.6rem 0.55rem 0.6rem;
  }

  .exercise-thumb { width: 3.5rem; height: 3.5rem; border-radius: 9px; }
  .fav-star { width: 2.5rem; height: 2.5rem; font-size: 1.2rem; }
  .guide-media { grid-template-columns: 1fr; }
  .guide-media img { max-width: 18rem; }

  .custom-row input, .custom-row select, .field input, .field select { font-size: 16px; min-height: 2.85rem; }

  .primary, .quiet { min-height: 2.75rem; }
  .tiny { min-height: 2.3rem; padding: 0.35rem 0.7rem; }
}

@media (max-width: 640px) {
  .set { grid-template-columns: 1.4rem minmax(0, 1fr) auto; }
  .tag { grid-column: 2 / -1; text-align: left; min-width: 0; }
  .session-head, .exercise-head { flex-direction: column; }
  .session-tools { align-items: flex-start; }
  h2 { font-size: 1.12rem; }
  .session-toggle { padding: 0.85rem 0.9rem 0.85rem 1.1rem; }
  .session-toggle h2 { font-size: 0.98rem; }
  .session-body { padding: 0 0.9rem 0.95rem 1.1rem; }
  .editor { padding: 0.9rem 0.85rem 0.75rem 1.05rem; }
  .editor-set {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 4.8rem;
    gap: 0.45rem;
    align-items: end;
  }
  .editor-set .field, .editor-set .rir-field, .editor-set .rir-gap { width: auto; }
  .editor-set .check { grid-row: 2; grid-column: 1; min-height: 2.85rem; }
  .editor-set .set-done { grid-row: 2; grid-column: 2; min-height: 2.85rem; font-size: 0.92rem; }
  .editor-set:not(:has(.check)) .set-done { grid-column: 1 / 3; }
  .editor-set > .tiny { grid-row: 2; grid-column: 3; min-height: 2.85rem; }
  .editor-set:not(:has(.set-done)) > .tiny { grid-column: 2 / -1; }
  .editor-set:not(:has(.set-done)):not(:has(.check)) > .tiny { grid-column: 1 / -1; }
  .editor-set .rir-field select { padding-left: 0.4rem; padding-right: 0.2rem; }
  .rest-presets .tiny { flex: 1; }
  .live-head { flex-direction: column; align-items: flex-start; }
  .rest-timer { flex-direction: column; align-items: stretch; }
  .rest-timer b { font-size: 2.6rem; }
  .rest-actions { justify-content: flex-start; }
  .rest-actions > * { flex: 1; }
  .rest-bar, .rest-presets { flex: none; width: 100%; }
}

@media (max-width: 380px) {
  .nav-seg button { font-size: 0.55rem; }
  .pulse-copy span { display: none; }
}

@media print {
  .toolbar, .foot, .topbar-actions, .pulse { display: none; }
  body { background: white; color: black; }
  .session, .exercise-card { break-inside: avoid; }
  .session, .session-body { display: block; }
}

/* ---------- Вход ---------- */

.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  overflow: hidden;
}

.login-page::before {
  content: "";
  position: fixed;
  inset: auto -20vmax -40vmax auto;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  border: 1px solid rgba(200, 255, 46, 0.1);
  box-shadow: 0 0 0 6vmax rgba(200, 255, 46, 0.015), 0 0 0 12vmax rgba(200, 255, 46, 0.01);
  pointer-events: none;
}

.login-shell { width: min(100%, 25rem); position: relative; }

.login-card {
  padding: 1.6rem 1.5rem 1.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0) 160px),
    rgba(19, 22, 25, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(200, 255, 46, 0.05);
}

.login-brand { margin-bottom: 0.4rem; }

.login-card h2 { margin: 0.2rem 0 0; font-size: 1.4rem; }

.login-card .field { gap: 0.35rem; }

.login-card .field span { font-size: 0.64rem; color: var(--muted); }

.login-card .field input {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--ink);
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.8rem;
}

.login-card .field input:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(200, 255, 46, 0.12);
}

.login-submit {
  margin-top: 0.4rem;
  width: 100%;
  min-height: 3rem;
  border: 0;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%);
}

.login-submit:hover { background: #d8ff66; }

.login-card .warning { margin: 0; }
