/* «Кольца силы» для iPhone — Liquid Glass, как Android-приложение: стеклянные поверхности поверх мягкого
   цветного фона, капсулы, крупные цифры. Цвета — переменные темы (js/ui/theme.js). */

:root {
  --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;
  --start-raise: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-space: calc(var(--tabbar-h) + var(--tabbar-gap) + var(--start-raise) + 28px + var(--safe-bottom));

  --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;

  --glass-blur: blur(24px) saturate(180%);
}

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

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

button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
/* Без меню «Сохранить картинку» по долгому нажатию и без увеличения двойным нажатием */
img, svg { -webkit-touch-callout: none; -webkit-user-drag: none; user-select: none; -webkit-user-select: none; }
html { touch-action: manipulation; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; user-select: none; -webkit-user-select: none; text-align: inherit; }
img { display: block; max-width: 100%; }
a { color: var(--accent-text); 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-text { color: var(--accent-text); }
.center { text-align: center; }
.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; }
.gap { height: 12px; }
.nowrap { white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

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

.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, var(--aurora-1), transparent); }
.aurora span:nth-child(2) { top: -25vmax; right: -45vmax; background: radial-gradient(closest-side, var(--aurora-2), transparent); animation-duration: 32s; animation-delay: -8s; }
.aurora span:nth-child(3) { bottom: -45vmax; right: -25vmax; background: radial-gradient(closest-side, var(--aurora-3), transparent); animation-duration: 38s; animation-delay: -14s; }
.aurora span:nth-child(4) { bottom: -35vmax; left: -45vmax; background: radial-gradient(closest-side, var(--aurora-4), 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); }
}

/* Под статус-баром: прокручиваемое не спорит с часами (значки статус-бара на iPhone всегда белые) */
.edge-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 15; pointer-events: none;
  height: calc(var(--safe-top) + 24px);
  background: linear-gradient(to bottom, rgba(var(--bg-rgb), 0.92), rgba(var(--bg-rgb), 0));
}
[data-theme="light"] .edge-top { background: linear-gradient(to bottom, rgba(13, 15, 20, 0.55), rgba(13, 15, 20, 0)); height: calc(var(--safe-top) + 10px); }
.edge-top.photo { background: linear-gradient(to bottom, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0)); }

#app { position: relative; z-index: 1; min-height: 100dvh; }
#app > main { position: relative; z-index: 1; }

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

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-edge), var(--glass-shadow);
}

.pressable { transition: transform 0.35s var(--spring), filter 0.2s; }
.pressable:active { transform: scale(0.97); }

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

.screen {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(14px + var(--safe-top)) 16px var(--tabbar-space);
  animation: screen-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.screen.no-tabbar { padding-bottom: calc(var(--safe-bottom) + 20px); }
.screen.sticky { padding-bottom: calc(var(--tabbar-space) + 84px); }
.screen.no-tabbar.sticky { padding-bottom: calc(var(--safe-bottom) + 104px); }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.top-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; margin-bottom: 8px; }
.page-head { margin: 4px 4px 18px; }
.eyebrow { font-size: 13px; font-weight: 600; line-height: 16px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.title { font-size: 34px; line-height: 38px; font-weight: 800; letter-spacing: -0.03em; }
.subtitle { font-size: 22px; line-height: 27px; font-weight: 700; letter-spacing: -0.02em; }
.section-title { font-size: 20px; line-height: 25px; font-weight: 700; letter-spacing: -0.02em; margin: 30px 4px 12px; }
.lead { font-size: 17px; line-height: 23px; color: var(--text-2); }
.prose { font-size: 16px; line-height: 23px; color: var(--text-2); white-space: pre-line; }
.card-label { font-size: 13px; line-height: 16px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; }
.item-title { font-weight: 600; font-size: 17px; line-height: 22px; letter-spacing: -0.01em; }
.item-sub { color: var(--text-2); font-size: 14.5px; line-height: 19px; margin-top: 2px; }
.disclaimer { font-size: 12.5px; color: var(--text-3); line-height: 18px; margin-top: 28px; text-align: center; }

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

.btn {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 56px; padding: 0 20px;
  border-radius: 999px;
  font-size: 17px; font-weight: 600; letter-spacing: -0.015em;
  transition: transform 0.35s var(--spring), filter 0.2s, opacity 0.2s;
}
.btn:active { transform: scale(0.965); }
.btn[disabled] { opacity: 0.4; pointer-events: none; }
.btn .ic { width: 20px; height: 20px; }
.btn-primary {
  color: var(--accent-ink); font-weight: 700;
  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.7), 0 0 0 0.5px rgba(255, 255, 255, 0.3), 0 14px 30px -12px rgba(var(--accent-rgb), 0.65);
}
.btn-primary::before {
  content: ""; position: absolute; z-index: -1; left: 6%; right: 6%; top: 2px; height: 46%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0));
}
.btn-primary:active { filter: brightness(1.06); }
.btn-secondary, .btn-glass { color: var(--text); background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); box-shadow: var(--glass-edge), var(--glass-shadow); }
.btn-outline { color: var(--text); box-shadow: inset 0 0 0 1.2px var(--outline); }
.btn-ghost { min-height: 48px; color: var(--text-2); font-size: 16px; }
.btn-danger { background: var(--danger-soft); color: var(--danger-text); }
.btn-compact { width: auto; min-height: 40px; padding: 0 16px; font-size: 16px; }
.btn + .btn { margin-top: 10px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-row .btn + .btn { margin-top: 0; }

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

.sticky-actions {
  position: fixed; z-index: 12; left: 0; right: 0;
  bottom: calc(var(--tabbar-h) + var(--tabbar-gap) + var(--start-raise) + 12px + var(--safe-bottom));
  padding: 0 16px; max-width: 560px; margin: 0 auto;
}
.sticky-actions.no-tabbar { bottom: calc(12px + var(--safe-bottom)); }
.sticky-actions::before {
  content: ""; position: absolute; left: -16px; right: -16px; top: -40px; bottom: -200px; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, rgba(var(--bg-rgb), 0), rgba(var(--bg-rgb), 0.92) 45%);
}

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

.card { border-radius: var(--r-lg); padding: 18px; position: relative; }
.card.xl { border-radius: var(--r-xl); padding: 20px; }
.card.accent {
  background: radial-gradient(120% 100% at 100% 0%, var(--glow-accent), transparent 62%),
    radial-gradient(90% 80% at 0% 100%, var(--glow-blue), transparent 62%), var(--glass);
}
button.card { display: block; width: 100%; text-align: left; transition: transform 0.35s var(--spring); }
button.card:active { transform: scale(0.98); }
.card + .card, .card + .list, .list + .card { margin-top: 12px; }

.list { border-radius: var(--r-lg); overflow: hidden; }
.list-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 58px; padding: 12px 16px; text-align: left;
  transition: background 0.2s;
}
.list-item + .list-item::before {
  content: ""; position: absolute; top: 0; right: 0; left: var(--inset, 16px); height: 0.5px; background: var(--separator);
}
button.list-item:active { background: var(--fill); }
.list-item .chev { color: var(--text-3); margin-left: auto; flex: none; width: 18px; height: 18px; }
.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; }

.thumb {
  width: 56px; height: 56px; border-radius: var(--r-sm); flex: none; overflow: hidden; padding: 3px;
  background: var(--fill); box-shadow: inset 0 0 0 0.6px var(--faint-edge);
}

/* Иконки в цветных «колодцах», как в настройках iOS */
.well {
  width: 32px; height: 32px; border-radius: 10px; flex: none;
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(180deg, var(--c1, #9aa0ad), var(--c2, #6b7180));
}
.well .ic { width: 58%; height: 58%; }
.well-accent { --c1: var(--well-1); --c2: var(--well-2); }
.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; flex: none;
  padding: 4px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; white-space: nowrap;
  background: var(--fill); color: var(--text-2);
}
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge-success { background: var(--success-soft); color: var(--success-text); }
.badge-warn { background: var(--warn-soft); color: var(--warn-text); }
.badge-danger { background: var(--danger-soft); color: var(--danger-text); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--text-2);
  background: var(--fill);
}
.chip .ic { width: 16px; height: 16px; }
.chip.accent { background: var(--accent-soft); color: var(--accent-text); }
button.chip { transition: transform 0.3s var(--spring); }
button.chip:active { transform: scale(0.94); }
button.chip.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

.code-pill {
  width: 46px; height: 46px; border-radius: 15px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 20px;
  background: var(--glass); box-shadow: inset 0 0 0 0.7px var(--faint-edge);
}
.code-pill.accent {
  color: var(--accent-ink);
  background: linear-gradient(180deg, var(--accent-hi), var(--accent) 46%, var(--accent-lo));
  box-shadow: inset 0 0 0 0.7px rgba(255, 255, 255, 0.5);
}

.stats { display: grid; grid-auto-columns: 1fr; grid-auto-flow: column; gap: 10px; }
.stat { border-radius: var(--r-md); padding: 12px 8px; text-align: center; aspect-ratio: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; min-width: 0; }
.stat b { display: block; font-size: 32px; font-weight: 700; line-height: 34px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat span { display: block; font-size: 13px; line-height: 16px; color: var(--text-2); margin-top: 4px; }
button.stat { transition: transform 0.35s var(--spring); }
button.stat:active { transform: scale(0.96); }

.empty { text-align: center; padding: 36px 16px; }
.empty .emoji { font-size: 48px; margin-bottom: 10px; }
.empty .lead + .lead { margin-top: 6px; }

.hero-emoji {
  width: 104px; height: 104px; 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(var(--accent-rgb), 0.45);
}

/* ---------- переключатель ---------- */

.switch { position: relative; width: 51px; height: 31px; border-radius: 999px; flex: none; background: var(--track); 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); }

/* ---------- варианты выбора (онбординг, шторки) ---------- */

.option {
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 68px; padding: 14px 16px;
  border-radius: var(--r-md); 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: 44px; height: 44px; border-radius: 13px; flex: none;
  display: inline-flex; align-items: center; justify-content: center; font-size: 24px; background: var(--fill);
}
.option .opt-title { font-size: 18px; line-height: 23px; font-weight: 700; }
.option.selected {
  background: linear-gradient(0deg, var(--accent-soft), var(--accent-soft)), var(--glass);
  box-shadow: inset 0 0 0 1.6px var(--accent-text), var(--glass-shadow);
}
.check-dot { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.check-dot .ic { width: 16px; height: 16px; }

/* ---------- поля ---------- */

.field {
  display: block; width: 100%; border-radius: var(--r-md); padding: 16px 18px;
  background: var(--glass); box-shadow: inset 0 0 0 1px rgba(var(--accent-text-rgb), 0.4), var(--glass-shadow);
  border: 0; outline: none; font-size: 18px; font-weight: 600; color: var(--text); caret-color: var(--accent-text);
}
.field::placeholder { color: var(--text-3); }
textarea.field { resize: none; min-height: 160px; font-weight: 500; font-size: 17px; line-height: 24px; }
.search {
  display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 14px; border-radius: var(--r-md);
}
.search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; font-size: 17px; }
.search input::placeholder { color: var(--text-3); }
.search .ic { width: 20px; height: 20px; color: var(--text-2); }

/* Степпер «− 60 +» */
.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;
  background: var(--glass); box-shadow: var(--glass-edge), var(--glass-shadow);
  transition: transform 0.3s var(--spring);
}
.stepper > button .ic { width: 30px; height: 30px; }
.stepper > button:active { transform: scale(0.88); }
.stepper input {
  width: 100%; min-width: 0; text-align: center; background: transparent; border: 0; outline: none; padding: 0;
  font-size: 46px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; caret-color: var(--accent-text);
}
.stepper input:focus { color: var(--accent-text); }
.mini-stepper { display: flex; align-items: center; min-height: 52px; }
.mini-stepper .label { flex: 1; font-size: 17px; }
.mini-stepper b { min-width: 64px; padding: 0 6px; text-align: center; font-size: 20px; font-variant-numeric: tabular-nums; }
.mini-stepper button {
  width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--glass); box-shadow: var(--glass-edge);
}
.mini-stepper button[disabled] { opacity: 0.35; }
.mini-stepper button .ic { width: 20px; height: 20px; }

/* ---------- парящий таб-бар со «Стартом» ---------- */

.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: calc(var(--tabbar-h) + var(--start-raise));
  transition: transform 0.3s, opacity 0.3s;
}
.tabbar-island {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--tabbar-h);
  padding: 5px; border-radius: 999px;
  display: grid; grid-template-columns: 1fr 1fr 76px 1fr 1fr;
  background: var(--tabbar);
  -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.6);
}
.tab-pill {
  position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc((100% - 10px - 76px) / 4);
  border-radius: 999px; background: var(--glass); box-shadow: var(--glass-edge);
  transition: transform 0.5s var(--spring), opacity 0.2s;
}
[data-theme="light"] .tab-pill { background: var(--accent-soft); box-shadow: none; }
.tab {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  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 .ic { width: 24px; height: 24px; }
.tab.active { color: var(--accent-text); }
.start {
  position: absolute; left: 50%; top: 0; transform: translateX(-50%);
  width: 72px; height: 72px; border-radius: 50%; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.start svg.week { position: absolute; inset: 0; width: 72px; height: 72px; transform: rotate(-90deg); }
.start button {
  width: 62px; height: 62px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; position: relative;
  color: var(--accent-ink); font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums;
  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.7), 0 8px 22px -6px rgba(var(--accent-rgb), 0.75);
  transition: transform 0.35s var(--spring);
}
.start button:active { transform: scale(0.92); }
.start button .ic { width: 28px; height: 28px; }
.start button svg.progress { position: absolute; inset: 6px; width: 50px; height: 50px; transform: rotate(-90deg); }
.start button span { font-size: 14px; }

/* ---------- фото в шапке ---------- */

.photo-backdrop {
  position: absolute; top: 0; left: 0; right: 0; z-index: 0; overflow: hidden; pointer-events: none;
  /* Снизу фото растворяется в фоне со «сиянием», а не обрывается краем */
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 98%); mask-image: linear-gradient(to bottom, #000 55%, transparent 98%);
}
.photo-backdrop img { width: 100%; height: 100%; object-fit: cover; }
.photo-backdrop::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.12) 30%, transparent 55%),
    radial-gradient(95% 60% at 0% 82%, rgba(var(--accent-rgb), 0.26), transparent 70%);
}
.photo-screen { position: relative; }
.photo-screen > .screen { position: relative; z-index: 1; }
.photo-head { padding: 0 4px 14px; color: #fff; text-shadow: 0 2px 16px rgba(0, 0, 0, 0.5); }
.photo-head .eyebrow { color: rgba(255, 255, 255, 0.8); }
.photo-head .title { color: #fff; }
.photo-head .sub { font-size: 17px; line-height: 23px; color: rgba(255, 255, 255, 0.88); margin-top: 6px; }
.photo-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-stats span {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.38); color: #fff; font-size: 14px; font-weight: 600; text-shadow: none;
}
.photo-stats .ic { width: 16px; height: 16px; opacity: 0.9; }

/* Над фото — матовое стекло */
.photo-screen .glass, .photo-screen .btn-secondary, .photo-screen .btn-glass { -webkit-backdrop-filter: blur(26px) saturate(160%); backdrop-filter: blur(26px) saturate(160%); }

/* ---------- кольца ---------- */

.rings { position: relative; flex: none; }
.rings svg { display: block; width: 100%; height: 100%; }
.rings > .inner { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; }
.ring-legend { display: flex; flex-direction: column; justify-content: space-between; flex: 1; min-width: 0; padding-left: 20px; }
.ring-legend > div { display: flex; align-items: center; }
.ring-legend i { width: 5px; height: 44px; border-radius: 3px; flex: none; }
.ring-legend .t { color: var(--text-2); font-size: 14px; line-height: 16px; font-weight: 500; }
.ring-legend b { font-size: 26px; line-height: 28px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; flex: none; }
.ring-legend small { color: var(--text-2); font-size: 14px; font-weight: 500; margin-left: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.week-days { display: flex; justify-content: space-between; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--separator); }
.week-day { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; color: var(--text-2); }
.week-day.today { color: var(--text); font-weight: 700; }

/* ---------- шторки, сообщения ---------- */

.scrim {
  /* Видимая часть экрана (js/ui/iphone.js): открылась клавиатура — шторка встаёт над ней */
  position: fixed; left: 0; right: 0; top: var(--vv-top, 0px); height: var(--vv-h, 100%); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
  background: var(--scrim);
  animation: fade 0.2s ease-out;
}
.scrim.closing { animation: fade-out 0.2s ease-in forwards; }
@keyframes fade { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
.sheet {
  width: 100%; max-width: 560px; max-height: calc(var(--vv-h, 100dvh) * 0.92); overflow-y: auto; -webkit-overflow-scrolling: touch;
  border-radius: 30px 30px 0 0;
  background: var(--sheet-bg);
  -webkit-backdrop-filter: blur(40px) saturate(180%); backdrop-filter: blur(40px) saturate(180%);
  box-shadow: var(--glass-edge), 0 -10px 60px -20px rgba(0, 0, 0, 0.6);
  padding: 10px 20px calc(20px + var(--safe-bottom));
  animation: sheet-in 0.42s cubic-bezier(0.2, 0.9, 0.3, 1);
  overscroll-behavior: contain;
}
.scrim.closing .sheet { animation: sheet-out 0.22s ease-in forwards; }
.sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--handle); margin: 0 auto 16px; }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes sheet-out { to { transform: translateY(100%); } }
.sheet-title { font-size: 22px; line-height: 27px; font-weight: 700; letter-spacing: -0.02em; text-align: center; margin-top: 4px; }
.sheet-text { color: var(--text-2); margin-top: 8px; font-size: 17px; line-height: 23px; text-align: center; white-space: pre-line; }
.sheet .glass, .sheet .option, .sheet .btn-secondary { -webkit-backdrop-filter: none; backdrop-filter: none; }
.sheet-gap { height: 18px; }

.toast {
  position: fixed; left: 50%; top: calc(8px + var(--safe-top)); z-index: 60;
  transform: translate(-50%, -140%);
  max-width: calc(100% - 48px);
  padding: 12px 20px; border-radius: 999px;
  background: var(--toast); color: var(--toast-text); font-weight: 600; font-size: 15px; text-align: center;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
  transition: transform 0.45s var(--spring), opacity 0.25s;
  pointer-events: none; opacity: 0;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { background: var(--toast-error); color: var(--toast-error-text); }

.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--track); border-top-color: var(--accent-text);
  animation: spin 0.8s linear infinite;
}
.btn .spinner { width: 22px; height: 22px; border-width: 2.5px; border-color: rgba(0, 0, 0, 0.15); border-top-color: currentColor; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; justify-content: center; min-height: 70dvh; }

/* ---------- картинки упражнений: маски фигуры и снаряда ---------- */

.ex-art { position: relative; width: 100%; height: 100%; }
.ex-art > i {
  position: absolute; inset: 0;
  -webkit-mask-size: 200% 100%; mask-size: 200% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
.ex-art > i.equipment { background: var(--art-equipment); -webkit-mask-position: 100% 0; mask-position: 100% 0; }
.ex-art > i.figure { background: var(--art-figure); -webkit-mask-position: 0 0; mask-position: 0 0; }
.ex-art > svg { width: 100%; height: 100%; }
.ex-box { aspect-ratio: 1; }

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

.onb { display: flex; flex-direction: column; min-height: 100dvh; padding: calc(20px + var(--safe-top)) 20px calc(20px + var(--safe-bottom)); max-width: 560px; margin: 0 auto; animation: screen-in 0.3s ease-out; }
.onb-steps { display: flex; gap: 6px; margin-bottom: 28px; }
.onb-steps span { flex: 1; height: 4px; border-radius: 2px; background: var(--track); transition: background 0.3s; }
.onb-steps span.on { background: var(--accent-text); }
.welcome-ring { display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.welcome-icons { display: flex; gap: 22px; margin-top: 24px; }
.welcome-icons .ic { width: 32px; height: 32px; color: var(--text-3); transition: color 0.3s; }
.welcome-icons .ic.on { color: var(--ring-1); }
.welcome-step { display: flex; flex-direction: column; align-items: center; width: 176px; text-align: center; animation: pop 0.3s ease-out; }
@keyframes pop { from { opacity: 0; transform: scale(0.8); } }


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

/* Без backdrop-filter стекло плотнее, чтобы текст читался */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  [data-theme="dark"] { --glass: linear-gradient(160deg, #23262f, #17191f); }
}

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

.session-frame {
  min-height: 100dvh; max-width: 560px; margin: 0 auto;
  display: flex; flex-direction: column;
  padding: calc(8px + var(--safe-top)) 16px calc(12px + var(--safe-bottom));
  animation: screen-in 0.25s ease-out;
}
.session-body { flex: 1; padding-bottom: 8px; }
.session-actions {
  position: sticky; bottom: calc(12px + var(--safe-bottom)); z-index: 5; padding-top: 12px;
}
.session-actions::before {
  content: ""; position: absolute; left: -16px; right: -16px; top: -30px; bottom: calc(-12px - var(--safe-bottom)); z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, rgba(var(--bg-rgb), 0), rgba(var(--bg-rgb), 0.92) 40%);
}
.session-dots { display: flex; gap: 6px; margin: 12px 0 4px; }
.session-dots button { flex: 1; height: 22px; display: flex; align-items: center; }
.session-dots i { display: block; width: 100%; height: 5px; border-radius: 3px; background: var(--track); transition: height 0.2s; }
.session-dots i.done { background: var(--accent-text); }
.session-dots i.progress { background: rgba(var(--accent-text-rgb), 0.45); }
.session-dots i.skipped { background: var(--text-3); }
.session-dots i.current { height: 8px; box-shadow: 0 0 0 1px var(--text-2); }

.note-row {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  margin-bottom: 14px; padding: 9px 12px; border-radius: 14px; color: var(--text-2); font-size: 15px;
  transition: transform 0.3s var(--spring);
}
.note-row:active { transform: scale(0.98); }
.note-row.filled { background: var(--fill); color: var(--text); font-weight: 600; }
.note-row .ic { color: var(--text-2); }

.ex-hero { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--r-lg); overflow: hidden; }
.ex-hero .hint {
  position: absolute; left: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.45); color: #fff; font-size: 13px; font-weight: 600;
}
.scheme-tile { border-radius: var(--r-md); padding: 12px 14px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.scheme-tile b { font-size: 24px; line-height: 30px; font-weight: 700; white-space: nowrap; }
.scheme-tile span { color: var(--text-2); font-size: 13px; line-height: 16px; }
.set-chip { padding: 6px 10px; border-radius: 12px; background: var(--fill); font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.check-circle {
  width: 26px; height: 26px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 2px var(--text-3); color: var(--accent-ink);
}
.check-circle.on { background: var(--accent-text); box-shadow: none; }
[data-theme="light"] .check-circle.on { color: #fff; }
.field-label { color: var(--text-2); font-size: 15px; font-weight: 600; text-align: center; margin: 26px 0 10px; }

.rest-ring { position: relative; margin: 12px 0; }
.rest-ring::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(var(--accent-rgb), 0.16), transparent);
}
.rest-ring.done::before { background: radial-gradient(closest-side, rgba(48, 209, 88, 0.16), transparent); }
.rest-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.rest-ring .time {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 68px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
}
.rest-ring.done .time { color: var(--success-text); }
.rest-ring.done { animation: pulse 1s ease-in-out 3; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }

/* ---------- прогресс ---------- */

.shortcut-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.shortcut-grid .card { margin: 0; padding: 14px; }
.shortcut .item-sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cal-row { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-head { text-align: center; font-size: 12px; color: var(--text-2); padding-bottom: 4px; }
.cal-cell { aspect-ratio: 1; padding: 3px; display: flex; }
.cal-day { flex: 1; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.cal-day.trained { color: var(--ring); font-weight: 700; box-shadow: inset 0 0 0 2.5px var(--ring); background: color-mix(in srgb, var(--ring) 14%, transparent); }
.cal-day.today { box-shadow: inset 0 0 0 1px var(--text-2); font-weight: 700; }
.cal-day.future { color: var(--text-3); }
.calendar-link { display: block; width: 100%; margin-top: 6px; padding: 8px 0; color: var(--accent-text); font-size: 15px; font-weight: 600; text-align: center; }
.month-arrow { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.month-arrow[disabled] { opacity: 0.3; }
.chart-axis { font-size: 11px; fill: var(--text-2); }
.chart-axis.selected { fill: var(--text); font-weight: 600; }
.chart-value { font-size: 12px; font-weight: 600; fill: var(--text); }
.chart-tip { position: absolute; width: 180px; padding: 8px; border-radius: 10px; background: var(--sheet); box-shadow: inset 0 0 0 1px var(--separator); pointer-events: none; }
.history-table { border-radius: var(--r-lg); overflow: hidden; }
.history-row { display: grid; grid-template-columns: 0.9fr 1fr 1.6fr; padding: 14px 16px; font-size: 16px; position: relative; font-variant-numeric: tabular-nums; }
.history-row + .history-row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 0.5px; background: var(--separator); }
.history-row.head { color: var(--text-2); font-size: 13px; font-weight: 600; padding: 12px 16px; }
.history-row b { font-weight: 600; }
.swipe { position: relative; overflow: hidden; touch-action: pan-y; }
.swipe + .swipe::before { content: ""; position: absolute; z-index: 2; top: 0; right: 0; left: var(--inset, 16px); height: 0.5px; background: var(--separator); }
.swipe-under { position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding-right: 20px; background: var(--danger); color: #fff; font-weight: 600; }
.swipe-row { position: relative; background: var(--sheet); transition: transform 0.2s; }
[data-theme="dark"] .swipe-row { background: #16181f; }
.swipe .list-item::before { display: none; }
.photo-tile { flex: none; width: 96px; aspect-ratio: 3 / 4; border-radius: var(--r-md); overflow: hidden; box-shadow: inset 0 0 0 1px var(--separator); }
.photo-tile.add { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.recap-card {
  border-radius: 28px; padding: 24px; color: #fff; overflow: hidden;
  background: radial-gradient(90% 60% at 100% 0%, color-mix(in srgb, var(--card-accent) 35%, transparent), transparent 70%), linear-gradient(180deg, #181B23, #0B0D12);
}
.recap-eyebrow { color: var(--card-accent); font-size: 13px; font-weight: 700; letter-spacing: 1.5px; }
.recap-tile { border-radius: 18px; background: rgba(255, 255, 255, 0.07); padding: 14px; display: flex; flex-direction: column; }
.recap-tile b { font-size: 24px; font-weight: 700; }
.recap-tile span { color: rgba(255, 255, 255, 0.6); font-size: 13px; }
.recap-tile small { color: rgba(255, 255, 255, 0.85); font-size: 12px; margin-top: 4px; }
/* Горизонтальные ленты без полосы прокрутки */
.chips, .photo-strip { scrollbar-width: none; }
.chips::-webkit-scrollbar, div::-webkit-scrollbar { display: none; }

/* ---------- профиль ---------- */
.avatar {
  position: relative; width: 72px; height: 72px; border-radius: 50%; flex: none; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, var(--accent-hi), var(--accent), var(--accent-lo));
  color: var(--accent-ink); font-size: 30px; font-weight: 800;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* Тема: стеклянная капсула переезжает к выбранному варианту */
.segmented {
  position: relative; display: grid; grid-template-columns: repeat(3, 1fr);
  height: 66px; padding: 4px; border-radius: 20px; background: var(--fill);
}
.segmented-thumb {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / 3); border-radius: 16px;
  transition: transform 0.45s var(--spring);
}
.segmented button {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-2); font-size: 13px; font-weight: 600; transition: color 0.25s;
}
.segmented button svg { width: 20px; height: 20px; }
.segmented button.on { color: var(--text); }

/* Акценты: два ряда по шесть кружков */
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px 0; }
.swatch { display: flex; flex-direction: column; align-items: center; padding: 4px 0; min-width: 0; }
.swatch .dot {
  width: min(46px, 12vw); aspect-ratio: 1; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px transparent; transition: transform 0.35s var(--spring), box-shadow 0.25s;
}
.swatch .dot svg { width: 18px; height: 18px; }
.swatch.on .dot { transform: scale(0.78); box-shadow: 0 0 0 3px var(--bg), 0 0 0 5.5px var(--ring); }
.swatch .label { margin-top: 6px; font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
.swatch.on .label { color: var(--text); font-weight: 600; }

/* Кто на главной: плитки с фото */
.photo-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.photo-pick button { display: flex; flex-direction: column; align-items: center; color: var(--text-2); font-size: 14px; font-weight: 600; }
.photo-pick img {
  width: 100%; aspect-ratio: 0.78; object-fit: cover; object-position: 50% 20%; border-radius: 16px;
  box-shadow: inset 0 0 0 0.7px var(--faint-edge); outline: 0.7px solid var(--faint-edge); outline-offset: -0.7px;
  transition: outline-color 0.2s;
}
.photo-pick button span { margin-top: 6px; }
.photo-pick button.on { color: var(--text); }
.photo-pick button.on img { outline: 2.5px solid var(--accent); outline-offset: -2.5px; }

/* Дни тренировок: семь кружков */
.day-pick { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day-pick button {
  aspect-ratio: 1; border-radius: 50%; background: var(--fill); color: var(--text); font-size: 15px; font-weight: 600;
  transition: background 0.2s, color 0.2s;
}
.day-pick button.on { background: var(--accent-text); color: var(--bg); }
/* Настройка и значение: название целиком, значение уступает место и обрезается */
.value-row > .grow { flex: none; white-space: nowrap; }
.list-item.value-row .value { flex: 1 1 auto; min-width: 0; max-width: none; }

/* Справочник: группы мышц плитками с фото — снизу затемнение, подписи белые в любой теме */
.group-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.group-tile {
  position: relative; height: 132px; border-radius: var(--r-lg); overflow: hidden; text-align: left;
  box-shadow: inset 0 0 0 0.7px rgba(255, 255, 255, 0.18); transition: transform 0.35s var(--spring);
}
.group-tile:active { transform: scale(0.97); }
.group-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 78%; }
.group-tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.72)); }
.group-tile span { position: absolute; z-index: 1; left: 14px; right: 14px; bottom: 14px; color: #fff; }
.group-tile b { display: block; font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-tile small { font-size: 13px; color: rgba(255, 255, 255, 0.8); }

/* Цитата на весь экран: фон — фото цитаты, притушенное; открытки листаются */
.quote-backdrop { position: fixed; inset: 0; z-index: -1; background: #000; pointer-events: none; }
.quote-backdrop img { width: 100%; height: 100%; object-fit: cover; opacity: 0.4; animation: fade 0.4s ease; }
.quote-screen .page-head .eyebrow { color: rgba(255, 255, 255, 0.75); }
.quote-screen .page-head .title { color: #fff; }
.quote-pager {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
}
.quote-page { flex: none; width: 100%; padding: 0 16px; scroll-snap-align: center; scroll-snap-stop: always; }
.quote-card { position: relative; aspect-ratio: 0.8; border-radius: 28px; overflow: hidden; background: #111; container-type: inline-size; }
.quote-card > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 60%; }
.quote-card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.8));
}
/* Пропорции — как у картинки 360 × 450 для «Поделиться»: на любом экране текст помещается одинаково */
.quote-card-body {
  position: absolute; inset: 0; z-index: 1; padding: 7.2cqw;
  display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; color: #fff;
}
.q-mark { color: var(--accent); font-size: 17.8cqw; line-height: 13.9cqw; font-weight: 700; }
.q-text { font-size: 7.2cqw; line-height: 9.2cqw; font-weight: 700; }
.q-text.long { font-size: 6.4cqw; line-height: 8.1cqw; }
.q-author { color: rgba(255, 255, 255, 0.8); font-size: 4.7cqw; margin-top: 3.9cqw; }
.q-app { display: flex; align-items: center; gap: 3.3cqw; }
.q-app img { width: 12.2cqw; height: 12.2cqw; border-radius: 50%; flex: none; }
.q-app b { display: block; font-size: 4.7cqw; }
.q-app small { display: block; font-size: 3.6cqw; color: rgba(255, 255, 255, 0.7); }

/* Друзья: первая буква имени в кружке */
.friend-avatar {
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-text); font-size: 17px; font-weight: 700;
}
