/* Приложение клиента Re-Flex. Цвета взяты с сайта клуба: черный фон, желтый акцент, теплый светлый текст. */

/* Шрифт Manrope (SIL Open Font License 1.1, текст лицензии - /fonts/Manrope-OFL.txt), вариативный 400-800, файлы
   с Google Fonts на своем сервере: внешние адреса запрещает политика CSP шлюза. */
@font-face {
  font-family: Manrope;
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(/fonts/manrope-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: Manrope;
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(/fonts/manrope-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: Manrope;
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(/fonts/manrope-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #0e0e0e;
  --surface: #1a1a1a;
  --surface-2: #242424;
  --line: #303030;
  --text: #eeeadd;
  --muted: #a09c90;
  --accent: #e8e619;
  --on-accent: #111111;
  --danger: #ff7a66;
  --ok: #8fd694;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --radius: 16px;
  --tab-h: 62px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f2ea;
    --surface: #ffffff;
    --surface-2: #ece9de;
    --line: #dcd8ca;
    --text: #1b1b1b;
    --muted: #6b675c;
    --accent: #1b1b1b;
    --on-accent: #f1f830;
    --danger: #c0392b;
    --ok: #23763a;
    --shadow: 0 8px 24px rgba(40, 36, 20, 0.14);
    color-scheme: light;
  }
}

:root[data-theme="light"] {
  --bg: #f4f2ea;
  --surface: #ffffff;
  --surface-2: #ece9de;
  --line: #dcd8ca;
  --text: #1b1b1b;
  --muted: #6b675c;
  --accent: #1b1b1b;
  --on-accent: #f1f830;
  --danger: #c0392b;
  --ok: #23763a;
  --shadow: 0 8px 24px rgba(40, 36, 20, 0.14);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

button, input { font: inherit; color: inherit; }

.app {
  min-height: 100%;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.noscript { padding: 24px 16px; }

/* Заставка */
.splash {
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.splash-logo { border-radius: 22px; }
.splash-title { font-size: 26px; font-weight: 700; letter-spacing: 0.04em; }

/* Шапка и содержимое экрана */
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px;
  background: var(--bg);
}
.top h1 {
  flex: 1;
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-btn {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}
.icon-btn svg { width: 22px; height: 22px; }

.content {
  flex: 1;
  padding: 4px 16px calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 24px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.content.no-tabs { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); }

h2 {
  margin: 10px 2px 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card.tap { cursor: pointer; }
.card-title { font-size: 17px; font-weight: 650; }
.row { display: flex; align-items: center; gap: 12px; }
.row > .grow { flex: 1; min-width: 0; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.big { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.nowrap { white-space: nowrap; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}
.badge.ok { color: var(--ok); }
.badge.warn { color: var(--danger); }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fact { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.fact b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.fact span { font-size: 12px; color: var(--muted); }

/* Кнопки */
.btn {
  appearance: none;
  border: 0;
  border-radius: 14px;
  min-height: 50px;
  padding: 0 18px;
  font-weight: 650;
  font-size: 16px;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  width: 100%;
}
.btn.secondary { background: var(--surface-2); color: var(--text); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
.btn.slim { min-height: 40px; font-size: 14px; padding: 0 14px; width: auto; }
.btn:disabled, .btn.busy { opacity: 0.5; cursor: default; }
.btn:active:not(:disabled) { transform: scale(0.985); }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) :focus-visible { outline-color: #8a8600; }
}

/* Поля ввода */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); }
.input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 18px;
}
.input.code { letter-spacing: 0.4em; text-align: center; font-size: 24px; font-variant-numeric: tabular-nums; }
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.stepper { display: flex; align-items: center; gap: 12px; }
.stepper button {
  width: 48px; height: 48px; border-radius: 14px; border: 0; background: var(--surface-2);
  font-size: 24px; cursor: pointer;
}
.stepper output { flex: 1; text-align: center; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Выбор дня и времени */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 6px; margin: 0 -16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  min-width: 58px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: center;
  cursor: pointer;
}
.chip b { display: block; font-size: 18px; }
.chip span { font-size: 12px; color: var(--muted); text-transform: lowercase; }
.chip.on, .slot.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.chip.on span { color: var(--on-accent); }

.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.slot {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

/* Списки */
.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 600; }
.item .chev { color: var(--muted); flex: none; }
.avatar {
  width: 48px; height: 48px; flex: none; border-radius: 50%; object-fit: cover;
  background: var(--surface-2); display: grid; place-items: center; font-weight: 700; color: var(--muted);
}

.history { display: flex; flex-direction: column; }
.history .line { display: flex; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.history .line:last-child { border-bottom: 0; }
.history .line .grow { flex: 1; min-width: 0; }
.amount { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
/* Подпись разработчика: ссылка на сайт и круглые значки ботов */
.dev-credit {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px;
  padding: 10px 0 4px; font-size: 13px; color: var(--muted);
}
.dev-credit .dev-site { color: var(--text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.dev-credit .brand { display: inline-flex; width: 32px; height: 32px; border-radius: 50%; }
.dev-credit .brand svg { display: block; }
/* Прайс: группа номенклатуры сворачивается, стрелка поворачивается при раскрытии */
.price-group { display: block; }
.price-group summary { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; list-style: none; }
.price-group summary .grow { flex: 1; min-width: 0; }
.price-group summary::-webkit-details-marker { display: none; }
.price-group summary::after {
  content: ""; width: 7px; height: 7px; flex: none; margin: 0 4px 3px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg);
}
.price-group[open] summary::after { transform: rotate(-135deg); margin-bottom: -3px; }
.price-group .history { margin-top: 6px; }
.amount.in { color: var(--ok); }

.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.notice { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.notice.error { color: var(--danger); }

/* Объявления клуба */
.announce.important { box-shadow: inset 3px 0 0 var(--accent); }
.announce-icon { color: var(--accent); display: grid; place-items: center; flex: none; }
.announce-icon svg { width: 22px; height: 22px; }
.announce-text { white-space: pre-line; overflow-wrap: anywhere; line-height: 1.45; }
.announce-text.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); }
.avatar.club { color: var(--accent); }
.avatar.club svg { width: 24px; height: 24px; }

/* Нижняя панель */
.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 6;
  display: flex;
  justify-content: center;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabs-inner { display: flex; width: 100%; max-width: 560px; height: var(--tab-h); }
.tab {
  flex: 1;
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
}
.tab svg { width: 24px; height: 24px; }
.tab.on { color: var(--text); }
.tab.on svg { color: var(--accent); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .tab.on svg { color: var(--text); }
}

/* Вход */
.login { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 24px 20px; min-height: 100vh; }
.login-logo { width: 84px; height: 84px; border-radius: 20px; }
.login h1 { margin: 0; font-size: 28px; }
.link { background: none; border: 0; padding: 8px 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 14px; }
.link:disabled { text-decoration: none; cursor: default; }

/* Окно подтверждения и сообщения */
dialog {
  border: 0;
  border-radius: 20px;
  padding: 20px;
  width: min(92vw, 420px);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog p { margin: 0 0 16px; font-size: 16px; }
dialog h3 { margin: 0 0 8px; font-size: 18px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 16px);
  transform: translateX(-50%);
  z-index: 20;
  max-width: min(92vw, 520px);
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  box-shadow: var(--shadow);
}
.toast.error { background: var(--danger); color: #111; }

/* Мой прогресс и питание */
.big-number { font-size: 30px; font-weight: 750; font-variant-numeric: tabular-nums; }
.weight-chart { width: 100%; height: auto; margin-top: 6px; }
.weight-chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.weight-chart .dot { fill: var(--accent); }
.weight-chart .goal { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 4; }
.history-list summary, .card details summary { cursor: pointer; color: var(--muted); font-size: 14px; padding: 6px 0; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.badge-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface);
  opacity: 0.55;
}
.badge-tile.on { opacity: 1; }
.badge-icon { color: var(--muted); }
.badge-tile.on .badge-icon { color: var(--accent); }
.badge-icon svg { width: 26px; height: 26px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-row .chip { padding: 10px 14px; }
.day-head { padding: 12px 2px 4px; }
.pre { white-space: pre-wrap; line-height: 1.45; }
.card-like { background: var(--surface); border-radius: var(--radius); }

/* Документ клуба (PDF.js): страницы во всю ширину, при увеличении - прокрутка вбок */
.pdf-screen { padding-left: 8px; padding-right: 8px; }
.pdf-bar { display: flex; align-items: center; gap: 8px; padding: 0 8px; }
.pdf-pages { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; overflow-x: auto; }
.pdf-page {
  flex: none;
  display: grid;
  place-items: center;
  background: #fff;
  color: #555;
  border-radius: 4px;
  box-shadow: var(--shadow);
}
.pdf-page canvas { display: block; border-radius: 4px; }
.pdf-footer { padding: 4px 0 8px; }

/* Поле подписи: белое, как бумага, - черная подпись видна в темной теме; жесты не прокручивают страницу */
.sign-card { width: min(100%, 560px); }
.sign-box { position: relative; border-radius: 12px; background: #fff; overflow: hidden; }
.sign-canvas { display: block; width: 100%; height: 200px; touch-action: none; cursor: crosshair; }
.sign-line {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 44px;
  border-bottom: 1px dashed #b5b2a8;
  pointer-events: none;
}
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; line-height: 1.35; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; accent-color: var(--accent); }

/* Заставка с видео клуба при запуске: поверх всего, текст и кнопка внизу на затемнении */
.intro {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: #000;
  color: #fff;
  transition: opacity 0.35s ease;
}
.intro.closing { opacity: 0; }
.intro-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.intro-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.85) 100%);
}
.intro-brand { position: relative; padding: 0 24px 16px; max-width: 560px; }
.intro-title { font-size: 36px; font-weight: 800; letter-spacing: 0.04em; }
.intro-sub { margin-top: 4px; font-size: 16px; color: rgba(255, 255, 255, 0.82); }
.intro-skip {
  position: relative;
  width: auto;
  align-self: stretch;
  max-width: 512px;
  margin: 0 24px calc(env(safe-area-inset-bottom, 0px) + 28px);
}

/* Вопросы первого запуска: геолокация для шлагбаума и уведомления */
.ask {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
  background: rgba(0, 0, 0, 0.6);
  transition: opacity 0.25s ease;
  overflow-y: auto;
}
.ask.closing { opacity: 0; }
.ask-card {
  width: min(100%, 440px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px 20px 16px;
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.ask-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--on-accent);
}
.ask-icon svg { width: 28px; height: 28px; }
.ask h2 { margin: 4px 0 0; font-size: 21px; font-weight: 700; letter-spacing: normal; text-transform: none; color: var(--text); }
.ask p { margin: 0; font-size: 16px; line-height: 1.4; }
.ask p.small { font-size: 13px; }
@media (prefers-reduced-motion: reduce) {
  .intro, .ask { transition: none; }
}

.skeleton { height: 92px; border-radius: var(--radius); background: var(--surface); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
  .btn:active:not(:disabled) { transform: none; }
}

.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }

/* Общее с приложением тренера: многострочные поля, счетчики на разделах, записи к тренеру, переписка */
textarea { font: inherit; color: inherit; }
.input.area {
  min-height: 92px;
  padding: 12px 14px;
  font-size: 16px;
  resize: vertical;
}
dialog .input.area { margin-bottom: 14px; }

.tab { position: relative; }
.tab .count {
  position: absolute;
  top: 6px;
  left: calc(50% + 6px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #111;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.record { gap: 8px; }
.record .when { font-weight: 650; font-variant-numeric: tabular-nums; }
.record .note { font-size: 14px; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; overflow-wrap: anywhere; }
.history .line .badge { align-self: flex-start; }
.coach .about { font-size: 14px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }

.chat-screen { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 96px); }
.bubbles { display: flex; flex-direction: column; gap: 6px; }
.bubble {
  max-width: 82%;
  padding: 9px 12px 6px;
  border-radius: 16px 16px 16px 6px;
  background: var(--surface);
  align-self: flex-start;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bubble.mine {
  align-self: flex-end;
  border-radius: 16px 16px 6px 16px;
  background: var(--surface-2);
}
.bubble .meta { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); text-align: right; }
.bubble-day { align-self: center; font-size: 12px; color: var(--muted); padding: 6px 0 2px; }
.composer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 6;
  display: flex;
  justify-content: center;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 10px 12px calc(env(safe-area-inset-bottom, 0px) + 10px);
}
.composer-inner { display: flex; gap: 8px; width: 100%; max-width: 560px; align-items: flex-end; }
.composer textarea {
  flex: 1;
  min-height: 46px;
  max-height: 140px;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg);
  resize: none;
  font-size: 16px;
}
.composer .btn { width: auto; min-height: 46px; }
.btn svg { width: 22px; height: 22px; flex: none; }
.dialog-item .last { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unread {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
  flex: none;
}

/* Карта клуба: код карты (браслета) для ресепшена */
.club-card { width: 100%; border: 0; text-align: left; color: inherit; font: inherit; }
.card-code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 18px; letter-spacing: 0.12em; text-align: center; font-variant-numeric: tabular-nums;
}
.card-code.big { font-size: 34px; font-weight: 700; word-break: break-all; }
.card-show { display: flex; flex-direction: column; gap: 16px; text-align: center; padding-top: 8px; }
/* Штрихкод карты: белая подложка с тихими зонами нужна сканеру и в темной теме */
.barcode { display: block; width: 100%; height: 64px; border-radius: 8px; background: #fff; }
.barcode.big { height: 140px; padding: 14px 0; border-radius: 14px; box-sizing: border-box; }
.plastic-barcode { height: 52px; margin-top: auto; }
.flip .back .plastic-barcode { height: 64px; margin-top: 0; }
.plastic .plastic-barcode + .plastic-code { margin-top: 0; font-size: 18px; }

/* Посещения по дням за 30 дней */
.visit-bars { display: flex; align-items: flex-end; gap: 3px; height: 44px; }
.visit-bars span { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-2); }
.visit-bars span.on { background: var(--accent); }

.item-icon {
  width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--accent);
}
.item-icon svg { width: 22px; height: 22px; }
.item-icon.warn { color: var(--danger); }
.warn-text { color: var(--danger); }
a.item { color: inherit; text-decoration: none; }

/* Расписание групповых занятий */
.day-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day-strip .day {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; border: 0;
  border-radius: 12px; background: var(--surface); color: var(--text); cursor: pointer;
}
.day-strip .day b { font-size: 17px; font-variant-numeric: tabular-nums; }
.day-strip .day span { color: var(--muted); }
.day-strip .day.empty b { color: var(--muted); font-weight: 500; }
.day-strip .day.on { background: var(--accent); color: var(--on-accent); }
.day-strip .day.on span, .day-strip .day.on b { color: var(--on-accent); }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filters:empty { display: none; }
.filter { display: flex; flex-direction: column; gap: 4px; }
.filter select {
  min-height: 42px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-size: 15px;
}
.class-card { border-left: 4px solid var(--line); }
.class-card.canceled { opacity: 0.6; }
.class-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.week-range { text-align: center; flex: 1; }
.btn.slim.nowrap { white-space: nowrap; flex: none; }
.class-card > .badge, .class-card > .btn.slim { align-self: flex-start; }

/* Главная "мой день" и раздел "Клуб" (план wc-next.md, этап 8е). Высоты и ширины столбиков задает скрипт
   свойствами элементов: политика CSP шлюза запрещает атрибут style. */
.hello { display: flex; flex-direction: column; gap: 2px; padding: 4px 2px 0; }
/* Кадры из видео клуба (re-flexnsk.ru, ролик "О клубе"): фото под приветствием и в шапках карточек. Затемнение
   снизу - чтобы текст читался в обеих темах */
.hello.photo-band {
  margin: -4px -16px 0; padding: 72px 18px 8px; justify-content: flex-end; min-height: 170px;
  background: linear-gradient(180deg, rgba(14, 14, 14, 0.15) 0%, var(--bg) 92%), url(/media/club-hero.jpg) center 35% / cover;
}
.photo-card {
  border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px;
  color: #eeeadd; min-height: 150px; background-color: #121212;
  background-size: cover; background-position: center;
}
.photo-card .muted { color: #c9c5b8; }
.photo-card .progress { background: rgba(255, 255, 255, 0.22); }
.photo-card .progress span { background: #e8e619; }
.club-photo { background-image: linear-gradient(180deg, rgba(0, 0, 0, 0.05) 30%, rgba(0, 0, 0, 0.78) 100%), url(/media/club-gym.jpg); }
.program-photo { background-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.85) 100%), url(/media/club-rowing.jpg); }
.photo-title { font-size: 22px; font-weight: 750; letter-spacing: -0.01em; }
.photo-sub { font-size: 13px; color: #c9c5b8; }
.hello-name { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.wave { display: block; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; }
.hello-wave { width: 72px; height: 10px; margin-top: 6px; opacity: 0.9; }

.my-day { border: 1px solid var(--line); }
.my-day-when { font-size: 13px; font-weight: 650; color: var(--accent); white-space: nowrap; }
.my-day-main { display: flex; align-items: baseline; gap: 10px; font-size: 18px; font-weight: 650; }
.my-day-main b { font-size: 26px; font-variant-numeric: tabular-nums; }
.btn-row > .btn.slim { width: 100%; }

.review-prompt .row .grow { min-width: 0; }
.review-prompt > .btn { align-self: flex-start; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tiles:empty { display: none; }
.tile {
  appearance: none; border: 0; border-radius: var(--radius); background: var(--surface); color: inherit;
  font: inherit; text-align: left; padding: 14px; display: flex; flex-direction: column; gap: 6px; cursor: pointer;
  min-height: 112px;
}
.tiles > .tile:only-child { grid-column: 1 / -1; }
.tile-big { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tile-big b { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.load-status { font-size: 13px; font-weight: 650; }
.load-status.free { color: var(--ok); }
.load-status.medium { color: var(--accent); }
.load-status.busy { color: var(--danger); }
.mini-bars { display: flex; align-items: flex-end; gap: 3px; height: 28px; margin-top: auto; }
.mini-bars span { flex: 1; border-radius: 2px; background: var(--muted); opacity: 0.35; }
.mini-bars span.on { opacity: 1; }
.mini-bars span.on { background: var(--accent); }
.week-tile { flex-direction: row; align-items: center; gap: 12px; }
.ring { width: 64px; height: 64px; flex: none; }
.ring circle { fill: none; stroke-width: 6; }
.ring .ring-bg { stroke: var(--surface-2); }
.ring .ring-fg { stroke: var(--accent); stroke-linecap: round; }
.ring text { fill: var(--text); font-size: 13px; font-weight: 700; }

.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.challenge-tile, .program-tile, .points-tile, .rings-card { width: 100%; border: 0; text-align: left; color: inherit; font: inherit; }

/* Карта клуба как пластиковая: фирменные цвета в обеих темах */
.plastic {
  appearance: none; width: 100%; border: 0; border-radius: 18px; padding: 18px; cursor: pointer; text-align: left;
  font: inherit; color: #eeeadd; display: flex; flex-direction: column; gap: 10px; aspect-ratio: 1.586;
  background: radial-gradient(120% 90% at 100% 0%, rgba(232, 230, 25, 0.22), transparent 55%),
    linear-gradient(135deg, #222 0%, #121212 60%, #1d1c10 100%);
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.plastic-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.plastic-logo { font-size: 22px; font-weight: 800; letter-spacing: 0.12em; color: #e8e619; }
.plastic-sub { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: #a09c90; }
.plastic-wave { width: 100%; height: 14px; opacity: 0.55; }
.plastic .wave { stroke: #e8e619; }
.plastic-code { margin-top: auto; font-size: 26px; font-weight: 700; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; }
.plastic-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; color: #a09c90; }
.plastic-foot b { color: #eeeadd; white-space: nowrap; }

.invite-banner { border: 1px dashed var(--line); }
.invite-code { display: flex; align-items: baseline; justify-content: space-between; background: var(--surface-2); border-radius: 12px; padding: 10px 14px; }
.invite-code b { font-size: 28px; letter-spacing: 0.2em; font-variant-numeric: tabular-nums; }
.btn svg { width: 20px; height: 20px; flex: none; }

/* Загруженность по часам */
.load-chart { display: flex; align-items: stretch; gap: 3px; height: 140px; }
.load-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.load-bars { flex: 1; display: flex; align-items: flex-end; gap: 1px; }
.load-bars span { flex: 1; border-radius: 2px 2px 0 0; }
.load-bars .typical { background: var(--muted); opacity: 0.35; }
.load-bars .today { background: var(--accent); }
.load-col.now .load-bars .typical { opacity: 0.6; }
.load-hour { height: 14px; font-size: 10px; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.load-col.now .load-hour { color: var(--text); font-weight: 700; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.legend .key::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .key.typical::before { background: var(--muted); opacity: 0.5; }
.legend .key.today::before { background: var(--accent); }

/* Программа, челленджи, оценки */
.stack { display: flex; flex-direction: column; gap: 14px; }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 6px; margin: 0 -16px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip-row.wrap { flex-wrap: wrap; overflow: visible; padding: 0; margin: 0; }
.chip.done:not(.on) { border-color: var(--ok); }
.chip.done:not(.on) span { color: var(--ok); }
.chip.tag { min-width: 0; font-size: 14px; padding: 8px 12px; color: var(--text); }
.chip.tag.on { color: var(--on-accent); }
.check-item { cursor: pointer; }
.check-item input, .check-line input { width: 22px; height: 22px; flex: none; accent-color: var(--accent); }
.check-line { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.board-row .place { width: 28px; text-align: center; font-variant-numeric: tabular-nums; color: var(--muted); }
.board-row.me { outline: 1px solid var(--accent); }
.board-row.me .place { color: var(--accent); }
.stars { display: flex; gap: 6px; justify-content: center; }
.star { appearance: none; border: 0; background: transparent; padding: 4px; cursor: pointer; color: var(--line); }
.star svg { width: 38px; height: 38px; fill: none; }
.star.on { color: var(--accent); }
.star.on svg { fill: currentColor; }

/* Новое достижение: всплывающая карточка; при "уменьшить движение" без анимации */
.celebrate { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.55); z-index: 60; padding: 24px; }
.celebrate-card {
  background: var(--surface); border-radius: 22px; padding: 24px 22px; max-width: 320px; width: 100%; text-align: center;
  display: flex; flex-direction: column; gap: 6px; align-items: center; box-shadow: var(--shadow);
  animation: celebrate-pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.celebrate-card b { font-size: 20px; }
.celebrate-icon { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--accent); animation: celebrate-glow 1.6s ease-in-out infinite; }
.celebrate-icon svg { width: 38px; height: 38px; }
@keyframes celebrate-pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes celebrate-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(232, 230, 25, 0.35); } 50% { box-shadow: 0 0 0 14px rgba(232, 230, 25, 0); } }
@media (prefers-reduced-motion: reduce) {
  .celebrate-card, .celebrate-icon { animation: none; }
}

/* Тепловая карта недели (этап 9в) */
.heat { display: flex; flex-direction: column; gap: 3px; }
.heat-row { display: grid; grid-template-columns: 22px repeat(var(--cols, 17), minmax(0, 1fr)); gap: 2px; align-items: center; }
.heat-row > b { font-size: 11px; font-weight: 600; color: var(--muted); }
.heat-row.today > b { color: var(--accent); }
.heat-row.head span { font-size: 9px; color: var(--muted); }
.heat .cell { height: 16px; border-radius: 3px; background: var(--surface-2); }
.heat .cell.lv1 { background: color-mix(in srgb, var(--accent) 18%, var(--surface-2)); }
.heat .cell.lv2 { background: color-mix(in srgb, var(--accent) 36%, var(--surface-2)); }
.heat .cell.lv3 { background: color-mix(in srgb, var(--accent) 56%, var(--surface-2)); }
.heat .cell.lv4 { background: color-mix(in srgb, var(--accent) 78%, var(--surface-2)); }
.heat .cell.lv5 { background: var(--accent); }

/* Таймер отдыха и видео в программе (этап 9б). Заливка кольца - переменная --done, ее ставит скрипт */
.check-item { flex-direction: column; align-items: stretch; }
.check-main { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.ex-tools { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 34px; }
.ex-tools .btn.slim { width: auto; }
.ex-tools svg { width: 18px; height: 18px; }
.timer-sheet {
  position: fixed; inset: 0; z-index: 70; background: var(--bg); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 24px; padding: 24px; text-align: center;
}
.timer-sheet .btn-row { width: 100%; max-width: 320px; }
.timer-sheet > .btn { max-width: 320px; }
.timer-ring {
  --done: 0deg;
  width: 240px; height: 240px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) var(--done), var(--surface-2) 0);
}
.timer-number {
  width: 208px; height: 208px; border-radius: 50%; background: var(--bg); display: grid; place-items: center;
  font-size: 56px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.timer-ring.finished { background: var(--accent); }
.timer-ring.finished .timer-number { font-size: 40px; color: var(--accent); }

/* Помощник (план wc-wow.md, этап 9а) */
.fab {
  position: fixed; right: 16px; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 16px); z-index: 5;
  display: inline-flex; align-items: center; gap: 8px; height: 52px; padding: 0 18px 0 14px; border: 0; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 700; box-shadow: var(--shadow); cursor: pointer;
}
.fab svg { width: 22px; height: 22px; }
.bubble.bot { display: flex; flex-direction: column; gap: 10px; max-width: 92%; white-space: normal; }
.bot-cards { display: flex; flex-direction: column; gap: 6px; }
.bot-card {
  appearance: none; border: 1px solid var(--line); background: var(--bg); color: inherit; font: inherit; text-align: left;
  border-radius: 12px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; cursor: pointer;
}
.bot-card span { font-size: 13px; color: var(--muted); }
.bot-actions, .bot-links { display: flex; flex-wrap: wrap; gap: 6px; }
.bot-actions .btn.slim, .bot-links .btn.slim { width: auto; flex: 0 1 auto; }
.assistant-consent { display: flex; flex-direction: column; gap: 10px; white-space: normal; border: 1px solid var(--line); }
.bubble.typing { flex-direction: row; gap: 4px; padding: 12px 14px; }
.bubble.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: typing 1s infinite ease-in-out; }
.bubble.typing span:nth-child(2) { animation-delay: 0.15s; }
.bubble.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .bubble.typing span { animation: none; } }

/* Баллы и уровни (этап 9г). Цвет уровня - переменная --lv, заливка кольца - --done, ее ставит скрипт */
.lv-start { --lv: var(--muted); }
.lv-bronze { --lv: #c98a4b; }
.lv-silver { --lv: #b9bec7; }
.lv-gold { --lv: #e3b93c; }
.lv-platinum { --lv: #8fdcd8; }
.level-ring {
  --done: 0deg;
  width: 112px; height: 112px; flex: none; border-radius: 50%; display: grid; place-content: center; text-align: center; position: relative;
  background: conic-gradient(var(--lv) var(--done), var(--surface-2) 0);
}
.level-ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--surface); }
.level-ring > * { position: relative; }
.level-ring b { font-size: 28px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.level-ring span { font-size: 12px; color: var(--muted); }
.level-ring.small { width: 52px; height: 52px; }
.level-ring.small::before { inset: 5px; }
.level-ring.small b { font-size: 15px; }
.points-hero { display: flex; flex-direction: row; align-items: center; gap: 16px; }
.points-hero .grow { display: flex; flex-direction: column; gap: 4px; }
.level-title { font-size: 24px; font-weight: 800; color: var(--lv); }
.lv-start .level-title { color: var(--text); }
.points-tile { display: flex; flex-direction: row; align-items: center; gap: 14px; text-align: left; }
.points-tile .chev { color: var(--muted); }
.redemption { display: flex; flex-direction: column; gap: 8px; }
.redeem-code {
  font-size: 40px; font-weight: 800; letter-spacing: 0.3em; text-align: center; padding: 10px 0 10px 0.3em;
  border: 2px dashed var(--line); border-radius: 12px; font-variant-numeric: tabular-nums;
}
.redemption .link { align-self: flex-start; }
.item.reward .btn.slim { flex: none; }
.plus { color: var(--ok); font-variant-numeric: tabular-nums; }

/* Фото прогресса (этап 9д). Граница сравнения - переменная --pos, ее двигает ползунок */
.photo-preview {
  min-height: 120px; border: 1px dashed var(--line); border-radius: 12px; display: grid; place-items: center; overflow: hidden;
}
.photo-preview img { width: 100%; max-height: 260px; object-fit: contain; display: block; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.photo-thumb {
  appearance: none; border: 0; padding: 0; position: relative; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden;
  background: var(--surface-2); cursor: pointer;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb-tag {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 6px 5px; font-size: 11px; color: #fff; text-align: left;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
}
.compare { --pos: 50%; position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--surface-2); touch-action: pan-y; }
.compare-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; }
.compare-after { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--pos)); }
.compare-line { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: #fff; pointer-events: none; }
.compare-knob {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 40px; height: 40px; border-radius: 50%;
  background: #fff; color: #111; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}
.compare-knob svg { width: 14px; height: 14px; }
.compare-tag {
  position: absolute; top: 10px; padding: 3px 8px; border-radius: 999px; font-size: 12px; color: #fff; background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}
.compare-tag.before { left: 10px; }
.compare-tag.after { right: 10px; }
.compare-range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.viewer {
  position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, 0.92); display: flex; flex-direction: column; justify-content: center;
  padding: 16px; gap: 12px; color: #fff;
}
.viewer > img { max-width: 100%; max-height: calc(100vh - 140px); object-fit: contain; align-self: center; border-radius: 12px; }
.viewer-bar { display: flex; align-items: center; gap: 8px; max-width: 520px; width: 100%; align-self: center; }
.viewer-bar .btn { flex: none; }

/* Дневник питания (этап 9е) */
.day-switch { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.day-switch b { text-align: center; }
.ghost-space { visibility: hidden; }
.food-total { display: flex; flex-direction: column; gap: 10px; }
.kcal-big { font-size: 40px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.food-total .announce-icon svg { width: 34px; height: 34px; }
.macro-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.macro { flex: 0 0 0; min-width: 0; }
.macro.protein, .macro-key.protein i { background: #7ec8f2; }
.macro.fat, .macro-key.fat i { background: #f2b46e; }
.macro.carbs, .macro-key.carbs i { background: #9edc8a; }
.macro-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.macro-key { display: inline-flex; align-items: center; gap: 6px; }
.macro-key i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chip-row.scroll { flex-wrap: nowrap; }
.chip-row.scroll .chip { white-space: nowrap; flex: none; }
.chip-row.scroll .chip span { margin-left: 6px; }
.food-time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; flex: none; width: 44px; }
.btn-row .btn svg { width: 18px; height: 18px; vertical-align: -3px; margin-right: 6px; }

/* Сторис (этапы 9ж-9з). Время слайда - анимация полоски, длительность - переменная --dur, ее ставит скрипт */
.stories { display: flex; gap: 14px; overflow-x: auto; padding: 4px 16px 2px; margin: 0 -16px; scrollbar-width: none; }
.stories::-webkit-scrollbar { display: none; }
.story-open, .story-open body { overflow: hidden; }
.story-dot {
  appearance: none; border: 0; background: none; color: inherit; font: inherit; padding: 0; cursor: pointer; flex: none;
  display: flex; flex-direction: column; align-items: center; gap: 6px; width: 66px;
}
.story-ring {
  width: 64px; height: 64px; border-radius: 50%; padding: 3px; display: grid; place-items: center;
  background: conic-gradient(from 200deg, #e8e619, #8fd694, #7ec8f2, #e8e619);
}
.story-dot.seen .story-ring { background: var(--line); }
.story-face {
  width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; background: var(--surface);
  border: 3px solid var(--bg); color: var(--accent);
}
.story-face svg { width: 26px; height: 26px; }
.story-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.story {
  position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; color: #eeeadd; user-select: none;
  background: #111; touch-action: none; padding: max(10px, env(safe-area-inset-top)) 0 env(safe-area-inset-bottom);
}
.story.theme-night { background: radial-gradient(120% 70% at 85% 0%, rgba(232, 230, 25, 0.28), transparent 60%), #111; }
.story.theme-accent { background: radial-gradient(120% 80% at 0% 100%, rgba(255, 255, 255, 0.35), transparent 60%), #e8e619; color: #111; }
.story.theme-photo {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.82) 70%), url(/media/club-gym.jpg) center / cover, #111;
}
.story-bars { display: flex; gap: 4px; padding: 0 12px; }
.story-bars span { flex: 1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.35); overflow: hidden; }
.story.theme-accent .story-bars span { background: rgba(0, 0, 0, 0.2); }
.story-bars i { display: block; height: 100%; width: 0; background: currentColor; }
.story-bars span.done i { width: 100%; }
.story-bars span.run i { animation: story-bar var(--dur, 6000ms) linear forwards; }
.story.paused .story-bars span.run i { animation-play-state: paused; }
@keyframes story-bar { from { width: 0; } to { width: 100%; } }
.story-close {
  position: absolute; top: max(22px, calc(env(safe-area-inset-top) + 12px)); right: 10px; width: 40px; height: 40px; border: 0;
  border-radius: 50%; background: rgba(0, 0, 0, 0.25); color: inherit; display: grid; place-items: center; cursor: pointer; z-index: 2;
}
.story-close svg { width: 22px; height: 22px; transform: rotate(45deg); }
.story-page { flex: 1; display: flex; min-height: 0; }
.story-body {
  flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 24px 28px 40px;
  max-width: 560px; margin: 0 auto; width: 100%; animation: story-in 0.35s ease-out;
}
@keyframes story-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.story-kicker { font-size: 14px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.75; }
.story-huge { font-size: clamp(52px, 16vw, 96px); font-weight: 800; line-height: 0.95; letter-spacing: -0.03em; }
.story-huge.small { font-size: clamp(40px, 12vw, 72px); }
.story-big { font-size: clamp(96px, 34vw, 180px); font-weight: 800; line-height: 0.9; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.story-big b { font-weight: inherit; }
.story-sub { font-size: 22px; font-weight: 700; margin-top: -6px; }
.story-text { font-size: 18px; line-height: 1.4; opacity: 0.9; }
.story-title { font-size: 30px; font-weight: 800; line-height: 1.15; }
.story-quote { font-size: 24px; font-weight: 700; line-height: 1.35; }
.story-hint { font-size: 13px; opacity: 0.6; margin-top: 18px; }
.story-chip { align-self: flex-start; padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); font-weight: 650; }
.story-chip.dark { background: rgba(0, 0, 0, 0.12); }
.story-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.story-row { display: flex; justify-content: space-between; gap: 10px; font-size: 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.14); padding-bottom: 6px; }
.story-btn { align-self: flex-start; width: auto; margin-top: 10px; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.story-btn svg { width: 18px; height: 18px; }
.story-btn.dark { background: #111; color: #e8e619; }
.story-btn.ghost { background: transparent; color: inherit; border: 1px solid currentColor; }
.story-body.share { justify-content: flex-start; padding-top: 48px; }
.share-preview { display: grid; place-items: center; min-height: 200px; }
.share-preview img { width: 100%; max-width: 360px; border-radius: 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); }
.story-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.story-actions .story-btn { align-self: auto; margin-top: 0; }
@media (prefers-reduced-motion: reduce) { .story-body { animation: none; } }

/* Кольца недели: цвета колец - посещения (акцент), тренировки, баллы */
.rings-card { display: flex; flex-direction: row; align-items: center; gap: 16px; text-align: left; }
.rings { width: 112px; height: 112px; flex: none; }
.rings circle { fill: none; stroke-width: 11; stroke-linecap: round; }
.rings .ring-fill { transition: stroke-dasharray 0.8s ease-out; }
.r-visits { --ring: #e8e619; }
.r-trainings { --ring: #8fd694; }
.r-points { --ring: #7ec8f2; }
:root[data-theme="light"] .r-visits { --ring: #c9c40f; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .r-visits { --ring: #c9c40f; } }
.rings .ring-track { stroke: color-mix(in srgb, var(--ring) 18%, var(--surface-2)); }
.rings .ring-fill { stroke: var(--ring); }
.rings-legend { display: flex; flex-direction: column; gap: 6px; }
.ring-line { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.ring-line i { width: 10px; height: 10px; border-radius: 50%; background: var(--ring); flex: none; }
.ring-line span { flex: 1; color: var(--muted); }
.ring-line b { font-variant-numeric: tabular-nums; }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 95; pointer-events: none; }

/* Карта с переворотом: две стороны пластика, поворот по нажатию */
.flip { perspective: 1200px; cursor: pointer; border-radius: 18px; outline-offset: 3px; }
.flip-inner { position: relative; aspect-ratio: 1.586; transition: transform 0.6s cubic-bezier(0.3, 0.7, 0.2, 1); transform-style: preserve-3d; }
.flip.flipped .flip-inner { transform: rotateY(180deg); }
.flip .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; aspect-ratio: auto; cursor: pointer; }
.flip .back { transform: rotateY(180deg); justify-content: center; align-items: center; text-align: center; gap: 12px; }
.plastic-code.big { margin-top: 0; font-size: clamp(30px, 10vw, 44px); letter-spacing: 0.18em; color: #e8e619; }
.flip .back .plastic-foot { justify-content: center; }
.plastic-btn { background: #e8e619; color: #111; }
@media (prefers-reduced-motion: reduce) { .flip-inner { transition: none; } }

/* Видео-шапка: ролик под затемнением, появляется плавно, когда начал играть */
.hello.photo-band.has-video { position: relative; isolation: isolate; overflow: hidden; }
.hello.photo-band.has-video::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(14, 14, 14, 0.2) 0%, var(--bg) 92%);
}
.hello-video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 35%; z-index: -2;
  opacity: 0; transition: opacity 0.8s ease;
}
.hello-video.on { opacity: 1; }

/* Переходы между экранами (View Transitions): короткая смена кадра, нижняя панель стоит на месте */
nav.tabs { view-transition-name: tabs; }
header.top { view-transition-name: top; }
::view-transition-old(root) { animation: vt-out 0.16s ease-in both; }
::view-transition-new(root) { animation: vt-in 0.22s ease-out both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(8px); } }
