/* Тренировка в зале — Liquid Glass: стеклянные поверхности поверх мягкого цветного фона,
   капсулы, крупные скруглённые цифры. Тёмная тема — основная. */

:root {
  --bg: #05060a;
  --text: #f5f7fa;
  --text-2: rgba(235, 240, 255, 0.64);
  --text-3: rgba(235, 240, 255, 0.4);

  --accent: #c6ff3d;
  --accent-hi: #e4ff94;
  --accent-lo: #9ddf14;
  --accent-ink: #0b1000;
  --accent-soft: rgba(198, 255, 61, 0.14);
  --mint: #4fe3b5;
  --blue: #4f9bff;
  --violet: #a97dff;
  --orange: #ff9f0a;
  --pink: #ff5f9e;
  --gray: #8e93a0;
  --success: #30d158;
  --success-soft: rgba(48, 209, 88, 0.16);
  --warn: #ff9f0a;
  --warn-soft: rgba(255, 159, 10, 0.16);
  --danger: #ff453a;
  --danger-soft: rgba(255, 69, 58, 0.16);

  /* стекло */
  --glass: linear-gradient(160deg, rgba(255, 255, 255, 0.13) 0%, rgba(255, 255, 255, 0.05) 42%, rgba(255, 255, 255, 0.075) 100%);
  --glass-fill: rgba(255, 255, 255, 0.07);
  --glass-blur: blur(24px) saturate(180%);
  --glass-edge: inset 0 1px 0.5px rgba(255, 255, 255, 0.3), inset 0 0 0 0.5px rgba(255, 255, 255, 0.13),
    inset 0 -1px 1px rgba(0, 0, 0, 0.22);
  --glass-shadow: 0 14px 34px -16px rgba(0, 0, 0, 0.75);
  --separator: rgba(255, 255, 255, 0.09);

  --r-xl: 32px;
  --r-lg: 26px;
  --r-md: 20px;
  --r-sm: 14px;
  --spring: cubic-bezier(0.34, 1.45, 0.5, 1);

  --tabbar-h: 64px;
  --tabbar-gap: 10px;
  --safe-top: var(--tg-content-safe-area-inset-top, 0px);
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --app-h: var(--tg-viewport-stable-height, 100dvh);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-round: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;

  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { background: var(--bg); }
body {
  margin: 0;
  min-height: var(--app-h);
  color: var(--text);
  font: 17px/1.38 var(--font);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

button, input { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
img { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, p { margin: 0; }
.ic { display: block; flex: none; }

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.accent { color: var(--accent); }
.center { text-align: center; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; min-width: 0; }

/* ---------- фон: мягкое «северное сияние» под стеклом ---------- */

.aurora { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; background: var(--bg); }
.aurora span {
  position: absolute; width: 80vmax; height: 80vmax; border-radius: 50%;
  will-change: transform;
  animation: drift 26s ease-in-out infinite alternate;
}
.aurora span:nth-child(1) { top: -40vmax; left: -30vmax; background: radial-gradient(closest-side, rgba(198, 255, 61, 0.26), transparent); }
.aurora span:nth-child(2) { top: -25vmax; right: -45vmax; background: radial-gradient(closest-side, rgba(70, 110, 255, 0.3), transparent); animation-duration: 32s; animation-delay: -8s; }
.aurora span:nth-child(3) { bottom: -45vmax; right: -25vmax; background: radial-gradient(closest-side, rgba(0, 210, 170, 0.22), transparent); animation-duration: 38s; animation-delay: -14s; }
.aurora span:nth-child(4) { bottom: -35vmax; left: -45vmax; background: radial-gradient(closest-side, rgba(150, 80, 255, 0.22), transparent); animation-duration: 30s; animation-delay: -20s; }
@keyframes drift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(6vmax, 5vmax, 0) scale(1.08); }
  100% { transform: translate3d(-5vmax, 8vmax, 0) scale(0.96); }
}

/* Размытие контента под верхним краем при прокрутке */
.edge-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 15; pointer-events: none;
  height: calc(var(--safe-top) + 30px);
  background: linear-gradient(to bottom, rgba(5, 6, 10, 0.75), rgba(5, 6, 10, 0));
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  -webkit-mask-image: linear-gradient(to bottom, #000 35%, transparent);
  mask-image: linear-gradient(to bottom, #000 35%, transparent);
}

#app { position: relative; z-index: 1; min-height: var(--app-h); }

/* ---------- стеклянные поверхности ---------- */

.glass, .card, .list, .stat, .menu-tile, .option, .icon-btn, .btn-secondary, .btn-outline, .btn-glass,
.scheme > div, .sets-list .set-line, .table, .stepper button, .ex-image {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-edge), var(--glass-shadow);
}

/* ---------- экран ---------- */

.screen {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(14px + var(--safe-top)) 16px calc(var(--tabbar-h) + var(--tabbar-gap) + var(--safe-bottom) + 28px);
  animation: screen-in 0.32s cubic-bezier(0.2, 0.9, 0.3, 1);
}
body.no-tabbar .screen { padding-bottom: calc(var(--safe-bottom) + 20px); }
@keyframes screen-in { from { opacity: 0; transform: translateY(10px) scale(0.99); } to { opacity: 1; transform: none; } }

.page-head { margin: 10px 4px 20px; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.title { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.subtitle { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.section-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); margin: 30px 4px 12px; }
.lead { font-size: 17px; color: var(--text-2); }

/* ---------- кнопки-капсулы ---------- */

.btn {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 60px; padding: 0 24px;
  border-radius: 999px;
  font-size: 18px; font-weight: 700; letter-spacing: -0.015em;
  transition: transform 0.35s var(--spring), filter 0.2s, opacity 0.2s;
}
.btn:active { transform: scale(0.965); filter: brightness(1.08); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

.btn-primary {
  color: var(--accent-ink);
  background: linear-gradient(180deg, var(--accent-hi) 0%, var(--accent) 46%, var(--accent-lo) 100%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.85), inset 0 -3px 8px rgba(70, 100, 0, 0.35),
    0 0 0 0.5px rgba(255, 255, 255, 0.4), 0 16px 36px -12px rgba(198, 255, 61, 0.6);
}
/* блик сверху — как у стекла */
.btn-primary::before {
  content: ""; position: absolute; z-index: -1; left: 6%; right: 6%; top: 2px; height: 48%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0));
}
.btn-secondary, .btn-outline, .btn-glass { color: var(--text); }
.btn-ghost { min-height: 48px; background: transparent; color: var(--text-2); font-weight: 600; font-size: 16px; }
.btn-danger { background: var(--danger-soft); color: var(--danger); box-shadow: var(--glass-edge); }
.btn-sm { min-height: 44px; font-size: 15px; padding: 0 16px; }
.btn .spinner { width: 22px; height: 22px; border-width: 3px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center; color: var(--text);
  transition: transform 0.35s var(--spring);
}
.icon-btn:active { transform: scale(0.9); }
.link-btn { color: var(--text-2); font-weight: 600; font-size: 15px; padding: 10px 6px; }

.sticky-actions {
  position: sticky; z-index: 5;
  bottom: calc(var(--tabbar-h) + var(--tabbar-gap) + var(--safe-bottom) + 12px);
  margin-top: 22px;
}
body.no-tabbar .sticky-actions { bottom: calc(var(--safe-bottom) + 12px); }
.sticky-actions::after {
  content: ""; position: absolute; inset: -36px -16px -20px; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, rgba(5, 6, 10, 0), rgba(5, 6, 10, 0.85) 55%);
}

/* ---------- карточки, списки ---------- */

.card { border-radius: var(--r-lg); padding: 18px; }
.card-accent {
  background: radial-gradient(120% 100% at 100% 0%, rgba(198, 255, 61, 0.3), rgba(198, 255, 61, 0) 58%),
    radial-gradient(90% 80% at 0% 100%, rgba(79, 155, 255, 0.18), rgba(79, 155, 255, 0) 60%), var(--glass);
}
.card-label { font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; }

.list { border-radius: var(--r-lg); overflow: hidden; }
.list-item {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 60px; padding: 12px 16px; text-align: left;
  transition: background 0.2s;
}
.list-item + .list-item::before {
  content: ""; position: absolute; top: 0; right: 0; left: 16px; height: 0.5px; background: var(--separator);
}
.list-item:has(> .well) + .list-item::before, .list-item:has(> .well) ~ .list-item::before { left: 60px; }
.list-item:has(> .thumb) + .list-item::before, .list-item:has(> .thumb) ~ .list-item::before { left: 86px; }
.list-item:has(> .code-pill) + .list-item::before, .list-item:has(> .code-pill) ~ .list-item::before { left: 74px; }
button.list-item:active, a.list-item:active { background: rgba(255, 255, 255, 0.06); }
.list-item .chev { color: var(--text-3); margin-left: auto; flex: none; }
.list-item .value { color: var(--text-2); margin-left: auto; text-align: right; flex: none; max-width: 55%; font-size: 16px; }
.list-item .value + .chev { margin-left: 2px; }
.list-item .value-fill { flex: 1 1 auto; min-width: 0; max-width: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nowrap { white-space: nowrap; }
.item-title { font-weight: 600; font-size: 17px; }
.item-sub { color: var(--text-2); font-size: 14.5px; margin-top: 2px; }

.thumb {
  width: 56px; height: 56px; border-radius: 16px; flex: none; overflow: hidden;
  background: rgba(255, 255, 255, 0.06); box-shadow: var(--glass-edge);
}
.thumb img { width: 100%; height: 100%; object-fit: contain; }

/* Иконки в цветных «колодцах», как в настройках iOS */
.well {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(180deg, var(--c1, #9aa0ad), var(--c2, #6b7180));
  box-shadow: inset 0 1px 0.5px rgba(255, 255, 255, 0.45), inset 0 -1px 1px rgba(0, 0, 0, 0.2);
}
.well .ic { width: 18px; height: 18px; }
.well-lime { --c1: #d9ff72; --c2: #95d411; color: var(--accent-ink); }
.well-mint { --c1: #6ff0c6; --c2: #1fb98a; }
.well-blue { --c1: #6fb1ff; --c2: #2f6fea; }
.well-violet { --c1: #c3a0ff; --c2: #7c4ddd; }
.well-orange { --c1: #ffc24d; --c2: #ff8a00; }
.well-pink { --c1: #ff8ab8; --c2: #ea3e7d; }
.well-red { --c1: #ff7b72; --c2: #e0302a; }
.well-gray { --c1: #a3a8b4; --c2: #6b7180; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 11px; border-radius: 999px;
  font-size: 13px; font-weight: 700; white-space: nowrap;
  background: rgba(255, 255, 255, 0.09); color: var(--text-2);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.2);
}
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px; border-radius: 999px; font-size: 14.5px; font-weight: 600;
  background: rgba(255, 255, 255, 0.08); box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.22), inset 0 0 0 0.5px rgba(255, 255, 255, 0.08);
}

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { border-radius: var(--r-md); padding: 16px 8px 14px; text-align: center; }
.stat b { display: block; font-family: var(--font-round); font-size: 32px; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat span { display: block; font-size: 13px; color: var(--text-2); margin-top: 4px; line-height: 1.25; }

.empty { text-align: center; padding: 36px 16px; color: var(--text-2); }
.empty .emoji { font-size: 44px; margin-bottom: 12px; }

.disclaimer { font-size: 12.5px; color: var(--text-3); line-height: 1.45; margin-top: 28px; text-align: center; }

/* ---------- парящий таб-бар ---------- */

#tabbar {
  position: fixed; z-index: 20; left: 50%;
  bottom: calc(var(--safe-bottom) + var(--tabbar-gap));
  transform: translateX(-50%);
  width: min(calc(100% - 28px), 440px); height: var(--tabbar-h);
  padding: 5px; border-radius: 999px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: linear-gradient(160deg, rgba(48, 52, 64, 0.55), rgba(20, 22, 30, 0.62));
  -webkit-backdrop-filter: blur(28px) saturate(190%); backdrop-filter: blur(28px) saturate(190%);
  box-shadow: var(--glass-edge), 0 20px 44px -14px rgba(0, 0, 0, 0.85);
  transition: width 0.45s var(--spring), height 0.45s var(--spring);
}
body.no-tabbar #tabbar { display: none; }
.tab-indicator {
  position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc((100% - 10px) / 4);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.08));
  box-shadow: inset 0 1px 0.5px rgba(255, 255, 255, 0.35), inset 0 0 0 0.5px rgba(255, 255, 255, 0.14);
  transform: translateX(calc(var(--tab, 0) * 100%));
  transition: transform 0.55s var(--spring), opacity 0.2s;
}
#tabbar:not(.has-active) .tab-indicator { opacity: 0; }
.tab {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-2); font-size: 10.5px; font-weight: 600; letter-spacing: 0;
  transition: color 0.2s, transform 0.35s var(--spring);
}
.tab:active { transform: scale(0.9); }
.tab svg { width: 25px; height: 25px; }
.tab.active { color: var(--accent); }
/* При прокрутке вниз таб-бар сжимается, как в iOS */
#tabbar.compact { height: 50px; width: min(calc(100% - 120px), 300px); }
#tabbar.compact .tab span { display: none; }

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

.hello { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.next-card { padding: 22px 20px 16px; border-radius: var(--r-xl); }
.next-card .workout-name { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; margin-top: 14px; line-height: 1.1; }
.next-card .meta { color: var(--text-2); font-size: 16px; margin-top: 6px; }
.next-card .btn { margin-top: 20px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.meta-row .chip { padding: 6px 11px; font-size: 14px; }

.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.menu-tile {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 18px;
  min-height: 112px; padding: 16px; border-radius: var(--r-lg);
  text-align: left; font-weight: 700; font-size: 17px;
  transition: transform 0.35s var(--spring);
}
.menu-tile:active { transform: scale(0.96); }
.menu-tile .well { width: 42px; height: 42px; border-radius: 13px; }
.menu-tile .well .ic { width: 24px; height: 24px; }

/* ---------- онбординг ---------- */

.onb { display: flex; flex-direction: column; min-height: calc(var(--app-h) - var(--safe-bottom)); }
.onb-body { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.onb-hero, .hero-emoji {
  width: 96px; height: 96px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 50px; line-height: 1;
  background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-edge), 0 0 60px -10px rgba(198, 255, 61, 0.35);
  margin-bottom: 24px;
}
.hero-emoji { margin: 18px auto 16px; }
.onb-steps { display: flex; gap: 6px; margin: 8px 0 28px; }
.onb-steps span { flex: 1; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); transition: background 0.3s; }
.onb-steps span.on { background: var(--accent); box-shadow: 0 0 10px rgba(198, 255, 61, 0.5); }

.option {
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 76px; padding: 12px 16px;
  border-radius: var(--r-lg); text-align: left;
  transition: transform 0.35s var(--spring), box-shadow 0.2s, background 0.2s;
}
.option:active { transform: scale(0.98); }
.option + .option { margin-top: 10px; }
.option .emoji {
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center; font-size: 24px;
  background: rgba(255, 255, 255, 0.08); box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.25);
}
.option .opt-title { font-size: 18px; font-weight: 700; }
.option .opt-hint { font-size: 14.5px; color: var(--text-2); margin-top: 2px; }
.option .badge { margin-left: auto; }
.option.selected {
  background: linear-gradient(160deg, rgba(198, 255, 61, 0.2), rgba(198, 255, 61, 0.06));
  box-shadow: inset 0 0 0 1.5px rgba(198, 255, 61, 0.8), var(--glass-edge), 0 0 30px -8px rgba(198, 255, 61, 0.45);
}
.check { color: var(--accent); flex: none; }

.toggle-row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 60px; padding: 12px 16px; text-align: left; }
.switch {
  position: relative; width: 51px; height: 31px; border-radius: 999px; flex: none; margin-left: auto;
  background: rgba(120, 120, 128, 0.36); transition: background 0.25s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25), 0 1px 1px rgba(0, 0, 0, 0.1);
  transition: transform 0.35s var(--spring);
}
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(20px); }

/* ---------- программа / тренировка ---------- */

.code-pill {
  width: 44px; height: 44px; border-radius: 14px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-round); font-weight: 800; font-size: 20px;
  background: rgba(255, 255, 255, 0.09); box-shadow: var(--glass-edge);
}
.code-pill.accent {
  color: var(--accent-ink);
  background: linear-gradient(180deg, var(--accent-hi), var(--accent-lo));
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.8), 0 6px 18px -6px rgba(198, 255, 61, 0.6);
}
.workout-card { display: block; margin-top: 10px; padding: 16px; border-radius: var(--r-lg); text-align: left; width: 100%; transition: transform 0.35s var(--spring); }
.workout-card:active { transform: scale(0.98); }
.ex-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-top: 8px; }
.ex-meta .badge { font-size: 14px; }
.trend-up { color: var(--success); }
.trend-down { color: var(--warn); }

/* ---------- тренировка: пошаговый экран ---------- */

.session { display: flex; flex-direction: column; min-height: calc(var(--app-h) - var(--safe-bottom) - 20px - var(--safe-top)); }
.session-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; }
.session-top .session-title {
  flex: 1; text-align: center; font-size: 15px; font-weight: 700; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.session-top .btn-glass { width: auto; min-height: 44px; padding: 0 16px; font-size: 15px; font-weight: 600; }

.dots { display: flex; gap: 6px; margin: 12px 2px 18px; }
.dots button { flex: 1; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); position: relative; transition: background 0.3s; }
.dots button::before { content: ""; position: absolute; inset: -12px 0; }
.dots button.done { background: var(--success); box-shadow: 0 0 8px rgba(48, 209, 88, 0.45); }
.dots button.progress { background: linear-gradient(90deg, var(--accent) 50%, rgba(255, 255, 255, 0.12) 50%); }
.dots button.current { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px rgba(255, 255, 255, 0.85); }
.dots button.skipped { background: rgba(255, 255, 255, 0.3); }

.counter { font-family: var(--font-round); font-size: 15px; font-weight: 700; color: var(--text-2); text-align: center; font-variant-numeric: tabular-nums; }
.ex-name { font-size: clamp(25px, 7.6vw, 32px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; text-align: center; margin: 6px 0 16px; }

.ex-image {
  display: block; width: 100%; aspect-ratio: 16 / 9; max-height: 30vh;
  border-radius: var(--r-xl); overflow: hidden; position: relative;
  background: radial-gradient(90% 90% at 50% 15%, rgba(198, 255, 61, 0.14), rgba(198, 255, 61, 0) 60%), var(--glass);
  transition: transform 0.35s var(--spring);
}
.ex-image:active { transform: scale(0.98); }
.ex-image img { width: 100%; height: 100%; object-fit: contain; }
.ex-image .info-hint {
  position: absolute; right: 10px; bottom: 10px;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text);
  background: rgba(20, 22, 30, 0.55); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: var(--glass-edge);
}
.ex-image .info-hint .ic { width: 14px; height: 14px; }

.scheme { display: grid; grid-template-columns: 1.45fr 1fr; gap: 10px; margin-top: 12px; }
.scheme > div { border-radius: var(--r-md); padding: 12px 16px; }
.scheme b { display: block; font-family: var(--font-round); font-size: 28px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.scheme span { font-size: 13px; color: var(--text-2); }

.info-cards { display: grid; gap: 10px; margin-top: 10px; }
.last-card { padding: 14px 16px; }
.last-sets { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; font-family: var(--font-round); font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.reco-card {
  padding: 14px 16px; display: flex; align-items: center; gap: 14px;
  background: radial-gradient(100% 140% at 100% 50%, rgba(198, 255, 61, 0.22), rgba(198, 255, 61, 0) 60%), var(--glass);
}
.reco-card .reco-weight { font-family: var(--font-round); font-size: 40px; font-weight: 800; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--accent); text-shadow: 0 0 24px rgba(198, 255, 61, 0.35); }
.reco-card .reco-weight small { font-size: 18px; font-weight: 700; margin-left: 2px; }
.reco-card p { font-size: 14px; color: var(--text-2); margin-top: 4px; }

.session-actions { margin-top: auto; padding-top: 16px; }
.nav-row { display: flex; justify-content: space-between; margin-top: 4px; }
.nav-row .btn-ghost { width: auto; padding: 0 12px; gap: 4px; }
.nav-row .btn-ghost .ic { width: 18px; height: 18px; }

/* запись подхода */

.set-head { text-align: center; margin: 8px 0 6px; }
.set-head .set-num { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.set-head .set-num span { color: var(--text-2); font-size: 24px; font-weight: 700; }
.set-head .target { color: var(--text-2); font-size: 16px; margin-top: 6px; }
.done-sets { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; min-height: 30px; margin: 12px 0 6px; }

.field-label { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-2); text-align: center; margin: 18px 0 8px; }
.stepper { display: grid; grid-template-columns: 76px 1fr 76px; align-items: center; gap: 8px; }
.stepper button {
  width: 76px; height: 76px; border-radius: 50%; color: var(--text);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.3s var(--spring), background 0.2s;
}
.stepper button .ic { width: 30px; height: 30px; stroke-width: 2.4; }
.stepper button:active { transform: scale(0.88); background: rgba(255, 255, 255, 0.18); }
.stepper input {
  width: 100%; min-width: 0; text-align: center; background: transparent; border: 0; outline: none; padding: 0;
  font-family: var(--font-round); font-size: 68px; font-weight: 700; letter-spacing: -0.03em; line-height: 1;
  font-variant-numeric: tabular-nums; caret-color: var(--accent);
}
.stepper input:focus { color: var(--accent); text-shadow: 0 0 30px rgba(198, 255, 61, 0.35); }

/* отдых */

.rest { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.rest-label { font-size: 15px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-2); margin-bottom: 16px; }
.rest-label.done { color: var(--success); letter-spacing: -0.01em; text-transform: none; font-size: 22px; }
.ring { position: relative; width: min(74vw, 290px); aspect-ratio: 1; }
.ring::before {
  content: ""; position: absolute; inset: 20px; border-radius: 50%;
  background: radial-gradient(80% 80% at 50% 20%, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02) 70%);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-edge);
}
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; filter: drop-shadow(0 0 10px rgba(198, 255, 61, 0.45)); }
.ring circle { fill: none; stroke-width: 14; stroke-linecap: round; }
.ring .track { stroke: rgba(255, 255, 255, 0.08); }
.ring .bar { transition: stroke-dashoffset 0.25s linear; }
.ring.done .bar { stroke: var(--success); }
.ring.done svg { filter: drop-shadow(0 0 14px rgba(48, 209, 88, 0.6)); }
.ring .time {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-round); font-size: 72px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
}
.rest .btn-row { width: 100%; margin-top: 24px; }
.saved-note {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
  padding: 6px 6px 6px 12px; border-radius: 999px; margin-bottom: 20px;
  font-weight: 700; font-size: 15px; color: var(--success);
  background: var(--success-soft); box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.2);
}
.saved-note .link-btn { padding: 4px 10px; font-size: 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); color: var(--text); }
.next-up { color: var(--text-2); font-size: 15px; margin-top: 16px; text-align: center; }

@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
.ring.done { animation: pulse 1s ease-in-out 3; }

/* итоги */

.sets-list { display: grid; gap: 8px; margin: 18px 0; }
.sets-list .set-line {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-radius: 999px;
  font-family: var(--font-round); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.sets-list .set-line span { color: var(--text-2); font-family: var(--font); font-size: 15px; font-weight: 600; }
.compare { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; text-align: center; }
.compare b { display: block; font-family: var(--font-round); font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; }
.compare span { font-size: 13px; color: var(--text-2); }
.compare .arrow { color: var(--text-3); }

.ex-summary { position: relative; padding: 12px 16px; }
.ex-summary + .ex-summary::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 0.5px; background: var(--separator); }
.ex-summary .sets-inline { color: var(--text-2); font-size: 15px; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* таблица истории */

.table { width: 100%; border-collapse: separate; border-spacing: 0; border-radius: var(--r-lg); overflow: hidden; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; padding: 14px 14px 10px; }
.table td { padding: 14px; border-top: 0.5px solid var(--separator); font-size: 16px; }
.table td:nth-child(2) { font-family: var(--font-round); font-weight: 700; white-space: nowrap; }

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

.ex-hero { aspect-ratio: 16 / 10; max-height: none; }
.muscle-chip { background: var(--accent-soft); color: var(--accent); }
.tip-card { background: radial-gradient(100% 120% at 0% 0%, rgba(255, 159, 10, 0.16), rgba(255, 159, 10, 0) 55%), var(--glass); }
.where-card { background: radial-gradient(100% 120% at 100% 0%, rgba(79, 155, 255, 0.18), rgba(79, 155, 255, 0) 55%), var(--glass); }
.where-card .where-img { border-radius: var(--r-md); background: rgba(0, 0, 0, 0.2); aspect-ratio: 16 / 9; margin: 12px 0; overflow: hidden; }
.where-card .where-img img { width: 100%; height: 100%; object-fit: contain; }
.prose { font-size: 16.5px; line-height: 1.5; color: rgba(245, 247, 250, 0.86); }
.card-label + .prose { margin-top: 6px; }

/* профиль */

.profile-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; margin: 12px 0 8px; }
.avatar {
  width: 92px; height: 92px; border-radius: 50%; flex: none; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-round); font-size: 38px; font-weight: 800; color: var(--accent-ink);
  background: linear-gradient(145deg, var(--accent-hi), var(--mint));
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.7), 0 0 0 4px rgba(255, 255, 255, 0.08), 0 16px 40px -12px rgba(198, 255, 61, 0.5);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- шторки, тосты ---------- */

.backdrop {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0 8px calc(8px + var(--safe-bottom));
  background: rgba(0, 0, 0, 0.4);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  animation: fade 0.2s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 560px; max-height: 86vh; overflow-y: auto;
  border-radius: 36px;
  background: linear-gradient(180deg, rgba(46, 50, 60, 0.78), rgba(24, 26, 34, 0.84));
  -webkit-backdrop-filter: blur(40px) saturate(180%); backdrop-filter: blur(40px) saturate(180%);
  box-shadow: var(--glass-edge), 0 30px 70px -20px rgba(0, 0, 0, 0.9);
  padding: 8px 16px 16px;
  animation: sheet-in 0.5s var(--spring);
}
.sheet::before { content: ""; display: block; width: 36px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.28); margin: 0 auto 14px; }
@keyframes sheet-in { from { transform: translateY(60%) scale(0.96); opacity: 0.4; } }
.sheet .sheet-title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin: 4px 4px 6px; }
.sheet .sheet-text { color: var(--text-2); margin: 0 4px 18px; font-size: 16px; }
.sheet .btn + .btn { margin-top: 10px; }
.sheet .card, .sheet .option { background: rgba(255, 255, 255, 0.07); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: var(--glass-edge); }
.sheet .option.selected { background: linear-gradient(160deg, rgba(198, 255, 61, 0.2), rgba(198, 255, 61, 0.06)); box-shadow: inset 0 0 0 1.5px rgba(198, 255, 61, 0.8); }
.sheet .chip { background: rgba(255, 255, 255, 0.1); }
.sheet .chip.muscle-chip { background: var(--accent-soft); }

#toast {
  position: fixed; left: 50%; top: calc(10px + var(--safe-top)); z-index: 60;
  transform: translate(-50%, -30px) scale(0.9);
  max-width: calc(100% - 32px);
  padding: 12px 20px; border-radius: 999px;
  background: rgba(30, 33, 42, 0.72); color: var(--text); font-weight: 650; font-size: 15px;
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--glass-edge), 0 14px 34px rgba(0, 0, 0, 0.45);
  transition: transform 0.45s var(--spring), opacity 0.25s, visibility 0.25s;
  pointer-events: none; opacity: 0; visibility: hidden;
}
#toast.show { transform: translate(-50%, 0) scale(1); opacity: 1; visibility: visible; }
#toast.error { background: rgba(90, 24, 28, 0.75); color: #ffd6d4; }

.spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.14); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; justify-content: center; min-height: 60vh; }

.error-box { text-align: center; padding: 60px 20px; }
.error-box .emoji { font-size: 48px; margin-bottom: 12px; }
.error-box p { color: var(--text-2); margin: 8px 0 20px; }

@media (max-height: 640px) {
  .ex-name { font-size: 25px; margin-bottom: 10px; }
  .ex-image { max-height: 25vh; }
  .stepper { grid-template-columns: 66px 1fr 66px; }
  .stepper button { width: 66px; height: 66px; }
  .stepper input { font-size: 56px; }
  .set-head .set-num { font-size: 34px; }
  .field-label { margin-top: 10px; }
}

/* Без поддержки backdrop-filter стекло делаем плотнее, чтобы текст читался */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --glass: linear-gradient(160deg, #23262f, #17191f); }
  #tabbar, .sheet, #toast { background: #1b1d24; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
