/* Оформление как в iOS-приложении: тёмная база, оранжевый акцент, крупные цифры. */
:root {
  --bg: #000;
  --card: #1c1c1e;
  --card-2: #2c2c2e;
  --sep: #2c2c2e;
  --text: #fff;
  --muted: #a1a1a6;
  --muted-2: #8e8e93;
  --faint: #636366;
  --accent: #ff8a3d;
  --accent-ink: #000;
  --accent-soft: #2a1a0e;
  --success: #38c770;
  --warning: #ffd60a;
  --danger: #ff6961;
  --record: #ffc733;
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 64px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body {
  color: var(--text);
  font: 17px/1.3 -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0; }

/* Широкий экран (компьютер): приложение по центру, шириной телефона. */
#app { max-width: 480px; margin: 0 auto; min-height: 100%; position: relative; }

.splash { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.logo { font-size: 32px; font-weight: 700; letter-spacing: -0.5px; }
.logo span, .accent { color: var(--accent); }
.muted { color: var(--muted); }
.faint { color: var(--muted-2); }
.num { font-variant-numeric: tabular-nums; }

/* Экран: вкладка или экран из стека. */
.screen {
  min-height: 100vh;
  padding: calc(var(--safe-top) + 12px) 16px calc(var(--tabbar-h) + var(--safe-bottom) + 40px);
  display: flex; flex-direction: column; gap: 16px;
}
.screen.plain { padding-bottom: calc(var(--safe-bottom) + 32px); }
.stack-layer { position: fixed; inset: 0; z-index: 20; background: var(--bg); overflow-y: auto;
  -webkit-overflow-scrolling: touch; max-width: 480px; margin: 0 auto; animation: slide-in .22s ease-out; }
@keyframes slide-in { from { transform: translateX(24px); } to { transform: none; } }

.tab-head { display: flex; flex-direction: column; gap: 4px; }
.tab-head-row { display: flex; justify-content: flex-end; min-height: 44px; }
.large-title { font-size: 34px; font-weight: 700; letter-spacing: -0.5px; }
.subtitle { color: var(--muted); font-size: 17px; }
.coach-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; margin-bottom: 4px; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }
.subtitle-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.streak { display: inline-flex; align-items: center; gap: 4px; padding: 5px 9px; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; white-space: nowrap; }
.section-title { font-size: 20px; font-weight: 600; }
.caps { font-size: 13px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .4px; padding: 6px 4px 0; }

.topbar { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.topbar-title { font-size: 17px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { display: flex; gap: 8px; }

.round-btn { width: 44px; height: 44px; border-radius: 22px; border: none; background: var(--card);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.program-drag-handle { background: transparent; cursor: grab; touch-action: none; }
.program-drag-handle:active { cursor: grabbing; }
.group > .sortable-ghost { opacity: .4; }
.avatar-btn { width: 44px; height: 44px; border-radius: 22px; border: 2px solid var(--accent); background: var(--card);
  font-size: 17px; font-weight: 600; }

/* Карточки и списки */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; }
.card.tight { padding: 0; }
.group { background: var(--card); border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 48px; border: none;
  background: none; width: 100%; text-align: left; }
.row + .row { border-top: 1px solid var(--sep); }
button.row:disabled { opacity: .4; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-sub { font-size: 13px; color: var(--muted-2); }
.row-value { color: var(--muted); font-size: 15px; }
.row .icon.chev { color: var(--faint); }
.row-icon { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.program-list { display: grid; gap: 8px; }
.program-list-item { display: flex; align-items: center; background: var(--card); border-radius: var(--radius); overflow: hidden; }
.program-list-item .row { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.program-plan-toggle { display: grid; place-items: center; min-width: 48px; min-height: 48px; margin: 0 8px; }
.program-plan-toggle input { appearance: none; width: 40px; height: 24px; border-radius: 12px;
  margin: 0; padding: 3px; background: var(--sep); }
.program-plan-toggle input::before { content: ""; display: block; width: 18px; height: 18px;
  border-radius: 50%; background: var(--text); }
.program-plan-toggle input:checked { background: var(--accent); }
.program-plan-toggle input:checked::before { transform: translateX(16px); background: var(--accent-ink); }

.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.stat-label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.stat-value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.empty { display: flex; flex-direction: column; gap: 8px; }
.empty-title { font-weight: 600; }

/* Кнопки */
.btn { height: 54px; border-radius: 27px; border: none; width: 100%; font-size: 17px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-start { background: var(--accent); color: #fff; height: 50px; border-radius: 25px; font-size: 18px; }
.btn-secondary { background: var(--card-2); color: var(--text); }
.btn-white { background: #fff; color: #000; }
.btn-danger { background: var(--danger); color: #000; }
.btn-plain { background: none; color: var(--muted); height: 48px; }
.btn:disabled { opacity: .5; }
.pill { height: 40px; padding: 0 18px; border-radius: 20px; border: none; font-size: 15px; font-weight: 600; }
.pill-success { background: var(--success); color: #000; }
.link-btn { border: none; background: none; color: var(--accent); font-size: 17px; padding: 6px 0;
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; }

/* Формы */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.input { height: 52px; border-radius: 12px; border: none; background: var(--card); color: var(--text);
  font-size: 17px; padding: 0 16px; width: 100%; }
.input::placeholder, .num-input::placeholder { color: var(--muted-2); }
.error { color: var(--danger); font-size: 15px; }
.info { color: var(--success); font-size: 15px; }
.check-row { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.35; }
.check-row input { width: 22px; height: 22px; accent-color: var(--accent); flex-shrink: 0; margin: 0; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted-2); font-size: 15px; }
.divider::before, .divider::after { content: ''; height: 1px; background: var(--sep); flex: 1; }

/* Нижнее меню */
.tabbar { position: fixed; left: 50%; transform: translateX(-50%); width: calc(min(100vw, 480px) - 24px);
  bottom: calc(var(--safe-bottom) + 12px); height: var(--tabbar-h); border-radius: 32px; background: rgba(28,28,30,.94);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border: 1px solid var(--sep);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; z-index: 10; }
.tab { border: none; background: none; color: var(--muted); font-size: 11px; display: flex; flex-direction: column;
  align-items: center; gap: 3px; height: 100%; justify-content: center; position: relative; }
.tab.active { color: var(--accent); }
.tab-center { width: 52px; height: 52px; border-radius: 26px; background: var(--accent); color: #fff; margin-top: -26px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 0 24px rgba(255,138,61,.35); }
.tab.active .tab-center { border: 2px solid #fff; }
/* Счётчик у обычной вкладки — у правого края значка. */
.tab:not(.tab-main) .badge { top: 6px; right: calc(50% - 22px); }
.tab-main { color: var(--accent); font-weight: 600; }
.badge { position: absolute; top: 4px; right: calc(50% - 26px); min-width: 18px; height: 18px; border-radius: 9px;
  background: #e5484d; color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center;
  justify-content: center; padding: 0 5px; }

/* Лист снизу */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; display: flex;
  align-items: flex-end; justify-content: center; animation: fade .15s ease-out; }
.sheet { width: 100%; max-width: 480px; background: var(--card); border-radius: 20px 20px 0 0;
  padding: 20px 16px calc(var(--safe-bottom) + 16px); max-height: 85vh; overflow-y: auto; display: flex;
  flex-direction: column; gap: 10px; animation: rise .2s ease-out; }
.sheet-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
/* Содержимое листа не сжимается, а прокручивается: иначе длинный список
   упражнений обрезался, а ряд групп мышц схлопывался в полоску. */
.sheet > * { flex-shrink: 0; }
.sheet { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sheet .chips { min-height: 34px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); } }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-bottom) + 96px);
  background: #3a3a3c; color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 15px; z-index: 50;
  max-width: calc(100vw - 32px); text-align: center; }

.banner { background: var(--card-2); border-radius: 12px; padding: 10px 14px; display: flex; align-items: center;
  gap: 10px; font-size: 15px; }
.hint-line { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted-2); justify-content: center; }

.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--card-2); border-top-color: var(--accent);
  animation: spin .8s linear infinite; margin: 24px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Сегодня */
.plan-card { border-radius: 20px; display: flex; flex-direction: column; gap: 12px; }
.plan-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.plan-title { font-size: 20px; font-weight: 700; }
.plan-meta { font-size: 15px; color: var(--muted); text-align: right; white-space: nowrap; }
.plan-ex { display: flex; gap: 14px; font-size: 15px; }
.plan-ex b { color: var(--accent); min-width: 24px; }
.resume-card { border: 1px solid var(--accent); }
.progress { height: 6px; border-radius: 3px; background: var(--card-2); overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); }

/* Тренировка */
.exercise-technique-media { display: block; width: 100%; aspect-ratio: 4/3; max-height: 420px; object-fit: contain; border-radius: 16px; background: var(--card); }
.exercise-technique-video {
  position: relative; width: 100%; max-width: calc(420px * var(--technique-ratio));
  aspect-ratio: var(--technique-ratio); margin-inline: auto;
  flex-shrink: 0; border-radius: 16px; overflow: hidden; background: #000;
}
.exercise-technique-video > * { position: absolute; inset: 0; width: 100%; height: 100%; }
.exercise-technique-video .exercise-technique-media { aspect-ratio: auto; border-radius: 0; background: #000; }
.exercise-technique-video [hidden] { display: none; }
.exercise-technique-tap {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  border: 0; background: transparent; color: #fff; cursor: pointer;
}
.exercise-technique-tap:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.exercise-technique-play { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: #000b; }
.exercise-technique-error { padding: 6px; border-radius: 12px; background: #000b; }
.workout-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.workout-title { font-size: 22px; font-weight: 700; }
.ex-card { border-radius: 20px; display: flex; flex-direction: column; gap: 10px; box-shadow: inset 0 0 0 1px var(--sep); }
.ex-card.current { box-shadow: inset 0 0 0 1.5px var(--accent); }
.ex-name { font-size: 17px; font-weight: 600; color: var(--accent); border: none; background: none; text-align: left; padding: 0; }
.ex-top { display: flex; align-items: flex-start; gap: 8px; }
.ex-top .ex-name { flex: 1; }
.superset-tag { font-size: 12px; font-weight: 600; color: #9e78f0; }
.set-grid { display: grid; grid-template-columns: 34px minmax(0, 1fr) 72px 60px 44px; gap: 8px; align-items: center; }
.set-grid.with-reserve {
  grid-template-columns: 15px minmax(48px, 1.25fr) minmax(36px, 1fr) minmax(44px, 1fr) 40px 40px;
  gap: 4px;
}
.set-head.with-reserve, .with-reserve .set-prev { font-size: 12px; }
.set-reserve { height: 44px; padding: 0; border: 0; background: transparent; color: var(--muted);
  font-size: 12px; font-variant-numeric: tabular-nums; }
.set-reserve:disabled { color: var(--muted-2); }
.set-head { font-size: 13px; color: var(--muted); }
.set-row { border-radius: 10px; padding: 3px 0; font-variant-numeric: tabular-nums; position: relative; }
/* Рекорд — значком над полем повторов, как в iOS: «Прошлый» остаётся видно. */
.record-badge { position: absolute; top: -7px; right: 52px; display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 6px; border-radius: 999px; background: rgba(255,199,51,.2); color: var(--record);
  font-size: 10px; font-weight: 700; line-height: 1.2; pointer-events: none; }
.with-reserve .record-badge { right: 88px; }
.set-row.done { background: rgba(56,199,112,.12); }
.set-no { font-weight: 600; padding-left: 4px; border: none; background: none; text-align: left; }
.set-no.warm { color: var(--warning); }
.set-prev { color: var(--muted-2); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num-input { height: 38px; border-radius: 8px; border: none; background: var(--card-2); color: var(--text); width: 100%;
  text-align: center; font-size: 17px; font-variant-numeric: tabular-nums; padding: 0 4px; }
.check-btn { width: 40px; height: 38px; border-radius: 8px; border: none; background: var(--card-2); color: var(--faint);
  display: flex; align-items: center; justify-content: center; }
.check-btn.on { background: var(--success); color: #000; }
.record-mark { color: var(--record); font-size: 12px; font-weight: 700; }

.workout-screen { padding-bottom: calc(var(--safe-bottom) + 40px); gap: 14px; }
.workout-screen.has-reserve-prompt { padding-bottom: calc(var(--safe-bottom) + 198px); }
.reserve-prompt { position: fixed; z-index: 32; bottom: 0; left: 50%; transform: translateX(-50%);
  width: min(100vw, 480px); padding: 9px 16px calc(var(--safe-bottom) + 2px);
  border-top: 1px solid var(--sep); background: var(--card);
  display: grid; gap: 6px; font-size: 15px; }
.reserve-prompt > .row-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reserve-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.reserve-options button { min-height: 44px; padding: 3px; border: 1px solid var(--sep); border-radius: 9px;
  color: var(--text); background: var(--card-2); font-size: 13px; font-weight: 600; }
.reserve-options button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.reserve-prompt .reserve-skip { justify-self: start; min-height: 36px; color: var(--muted); font-size: 13px; }

.rest-bar { position: fixed; left: 50%; transform: translateX(-50%); width: calc(min(100vw, 480px) - 24px);
  bottom: calc(var(--safe-bottom) + 12px); border-radius: 24px; background: rgba(28,28,30,.96); border: 1px solid var(--sep);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; z-index: 30;
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.rest-row { display: flex; align-items: center; justify-content: space-between; }
.rest-time { font-size: 34px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; text-align: center; }
.rest-btn { width: 60px; height: 44px; border-radius: 22px; border: none; background: var(--card-2); font-size: 15px; }

/* Установка */
.install { min-height: 100vh; display: flex; flex-direction: column; padding: calc(var(--safe-top) + 48px) 20px 160px; gap: 24px; }
.install-hero { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.app-icon { width: 84px; height: 84px; border-radius: 20px; }
.step-no { width: 32px; height: 32px; border-radius: 16px; background: var(--accent); color: #000; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.install-arrow { position: fixed; bottom: calc(var(--safe-bottom) + 8px); left: 50%; transform: translateX(-50%);
  color: var(--accent); animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 50% { translate: 0 8px; } }

.summary-hero { text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; padding: 24px 0 8px; }
.summary-hero .trophy { width: 88px; height: 88px; border-radius: 44px; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; }

.ex-thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--card-2); flex-shrink: 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { height: 34px; padding: 0 14px; border-radius: 17px; border: none; background: var(--card); color: var(--text);
  font-size: 15px; white-space: nowrap; flex-shrink: 0; }
.chip.on { background: var(--accent); color: #000; font-weight: 600; }
.weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.weekdays .chip { padding: 0; }

/* Чат */
.chat-layer { top: var(--chat-top, 0px); bottom: auto; height: var(--chat-height, 100%);
  display: flex; flex-direction: column; overflow: hidden; }
.chat-head { padding: calc(var(--safe-top) + 12px) 16px 8px; border-bottom: 1px solid var(--sep); }
.chat-list { flex: 1 1 0; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch;
  padding: 12px 12px 16px; display: flex; flex-direction: column; gap: 6px; }
.chat-head, .chat-input, .chat-quote, .chat-list > * { flex-shrink: 0; }
.bubble { display: flex; }
.bubble.mine { justify-content: flex-end; }
.bubble-body { max-width: 80%; background: var(--card); border-radius: 18px; padding: 8px 12px; display: flex; flex-direction: column;
  gap: 4px; border: none; text-align: left; font-size: 16px; line-height: 1.35; }
.bubble.mine .bubble-body { background: #3a2412; }
.bubble.pending .bubble-body { opacity: .75; }
.bubble-time { font-size: 11px; color: var(--muted-2); align-self: flex-end; }
.chat-weight { min-width: 0; border-top: 1px solid var(--sep); margin-top: 4px; padding-top: 8px;
  display: grid; gap: 8px; }
.chat-weight-heading { display: grid; }
.chat-weight small { color: var(--muted); font-size: 13px; }
.chat-weight ul { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.chat-weight li { display: grid; gap: 2px; padding: 7px 8px; border-radius: 8px; background: var(--bg); }
.chat-weight li span + span { font-size: 14px; font-variant-numeric: tabular-nums; }
.chat-weight del { color: var(--muted); text-decoration: none; }
.chat-weight .btn { min-height: 40px; }
.bubble-quote { font-size: 13px; color: var(--muted); border-left: 2px solid var(--accent); padding-left: 8px; }
.msg-media { width: 100%; max-width: 260px; border-radius: 12px; display: block; object-fit: cover; background: var(--card-2); }
.chat-input { display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px calc(var(--safe-bottom) + 8px); border-top: 1px solid var(--sep); background: var(--bg); }
.chat-text { height: 44px; min-height: 44px; border-radius: 22px; padding: 11px 16px; resize: none; line-height: 1.3; }
.card .chip { background: var(--card-2); }
.card .chip.on { background: var(--accent); }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--card); border-radius: 12px; padding: 3px; gap: 2px; }
.segmented button { border: none; background: none; height: 36px; border-radius: 9px; font-size: 13px; color: var(--muted); padding: 0 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.segmented button.on { background: var(--card-2); color: var(--text); font-weight: 600; }
/* Поиск и группы мышц остаются наверху листа, пока список прокручивается. */
.sheet-sticky { position: sticky; top: -20px; z-index: 1; background: var(--card); margin: 0 -16px; padding: 8px 16px 10px;
  display: flex; flex-direction: column; gap: 10px; }
.sheet-sticky .chip { background: var(--card-2); }
.sheet-sticky .chip.on { background: var(--accent); }
/* Отметка выбранного упражнения: номер — порядок, в котором оно встанет. */
.pick-mark { width: 24px; height: 24px; border-radius: 12px; border: 2px solid var(--faint); flex-shrink: 0; display: flex;
  align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #000; }
.pick-mark.on { background: var(--accent); border-color: var(--accent); }
/* Кнопка «Добавить» — внизу, ближе к пальцу, и не уезжает при прокрутке. */
.sheet-confirm { position: sticky; bottom: calc(-16px - var(--safe-bottom)); background: var(--card); margin: 0 -16px;
  padding: 10px 16px calc(var(--safe-bottom) + 16px); z-index: 1; }
/* Панель над клавиатурой при вводе веса и повторов — как в iOS. */
.keyboard-bar { position: fixed; left: 50%; transform: translateX(-50%); width: min(100vw, 480px); z-index: 35;
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #2c2c2e; border-top: 1px solid #3a3a3c; }
.keyboard-bar button { height: 36px; min-width: 52px; padding: 0 10px; border-radius: 8px; border: none; background: #48484a;
  color: var(--text); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.keyboard-bar .kb-wide { font-size: 13px; font-weight: 500; white-space: nowrap; }
.keyboard-bar .kb-done { background: none; color: var(--accent); }
.superset-badge { font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 999px; background: rgba(255,138,61,.2);
  color: var(--accent); white-space: nowrap; flex-shrink: 0; }
/* Панель отдыха сверху экрана тренировки — как в iOS. */
.rest-top { position: fixed; left: 50%; transform: translateX(-50%); width: min(100vw, 480px); top: 0; z-index: 30;
  padding: calc(var(--safe-top) + 10px) 16px 10px; display: flex; flex-direction: column; gap: 8px;
  background: rgba(28,28,30,.94); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border-bottom: 1px solid var(--sep); }
.rest-top .rest-row { gap: 10px; }
.rest-top .rest-time { font-size: 32px; line-height: 1.1; }
.rest-top .rest-btn { width: 52px; height: 40px; }

/* Пояснение под группой, как footer секции в iOS. */
.footnote { font-size: 13px; line-height: 1.35; color: var(--muted-2); padding: 0 16px; margin-top: -6px; }
.stepper { display: inline-flex; border-radius: 9px; overflow: hidden; background: var(--card-2); flex-shrink: 0; }
.stepper button { width: 46px; height: 32px; border: none; background: none; color: var(--text); font-size: 20px; line-height: 1; }
.stepper button + button { border-left: 1px solid var(--sep); }
.stepper button:disabled { color: var(--faint); }

.muscle-chip { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.muscle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.muscle-grid .chip { justify-content: center; font-size: 13px; }
.select { background: none; border: none; color: var(--accent); font: inherit; font-size: 15px; text-align: right; max-width: 55%; }
.step-no { width: 22px; height: 22px; border-radius: 11px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; }
.sheet .muscle-grid .chip:not(.on) { background: var(--card-2); }
.chat-quote { display: flex; align-items: flex-start; gap: 8px; padding: 8px 12px 0; border-top: 1px solid var(--sep); background: var(--bg); }
.chat-quote + .chat-input { border-top: none; }
.chat-quote .bubble-quote { flex: 1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Помощник */
.coach-report { display: flex; flex-direction: column; gap: 8px; text-align: left; border: 1.5px solid transparent; color: inherit; }
.coach-report.unread { background: var(--accent-soft); border-color: rgba(255,138,61,.55); }
.coach-invite { display: flex; align-items: center; gap: 12px; text-align: left; border: none; color: inherit; }
.dot { width: 8px; height: 8px; border-radius: 4px; background: var(--accent); flex-shrink: 0; display: inline-block; }
.coach-hero { width: 72px; height: 72px; border-radius: 36px; margin: 12px auto 0; display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); }
.goal-tile { display: flex; flex-direction: column; gap: 4px; text-align: left; min-height: 86px; border: 1.5px solid transparent; color: inherit; }
.goal-tile.on { background: var(--accent-soft); border-color: var(--accent); }
.goal-input { width: 70px; background: none; border: none; color: var(--text); font-size: 17px; font-weight: 600; text-align: right; }
/* Сворачивание — только по нажатию, выполнение подхода не прячет поля. */
.exercise-collapse-tools { display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.exercise-collapse-tools .link-btn { min-height:44px; font-size:14px; }
.exercise-status { font-size:12px; margin-top:4px; }
.workout-detail-overlay { position:fixed; inset:0; z-index:35; }
.completed-plan { border:1px solid var(--success); }
.completed-plan-status { display:flex; justify-content:space-between; gap:8px; flex-wrap:wrap; font-size:12px; }
.completed-plan-status>span:first-child { display:flex; align-items:center; gap:5px; color:var(--success); }

/* Стартовая анкета */
.onboarding { gap: 14px; min-height: 100dvh; }
.onboarding-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.onboarding-top .logo { font-size: 24px; }
.onboarding-progress { width: 100%; height: 5px; border: 0; border-radius: 5px; appearance: none; }
.onboarding-progress::-webkit-progress-bar { background: var(--card); border-radius: 5px; }
.onboarding-progress::-webkit-progress-value { background: var(--accent); border-radius: 5px; }
.onboarding-progress::-moz-progress-bar { background: var(--accent); border-radius: 5px; }
.onboarding-choices, .onboarding-actions, .onboarding-summary { display: flex; flex-direction: column; gap: 10px; }
.onboarding-choices .onboarding-choice { display: flex; align-items: center; gap: 12px; min-height: 66px;
  padding: 12px; text-align: left; border: 1px solid var(--card); }
.onboarding-choice[aria-pressed=true] { border-color: var(--accent); background: var(--accent-soft); }
.onboarding-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px;
  border-radius: 12px; background: var(--card-2); color: var(--accent); }
.onboarding-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.onboarding-chips .chip { min-height: 40px; }
.onboarding-actions { margin-top: auto; padding-top: 8px; }
.onboarding-summary > span { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }
.onboarding-summary b { color: var(--text); text-align: right; }
.onboarding-error { color: var(--danger); }
.checkin-week, .checkin-edit-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.checkin-week .link-btn { text-align: left; font-size: 19px; }
.checkin-status { flex: none; border-radius: 999px; padding: 5px 10px; background: var(--card-2); color: var(--muted); font-size: 12px; }
.checkin-progress, .checkin-scale { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.checkin-progress span { height: 3px; border-radius: 3px; background: var(--card-2); }
.checkin-progress .on, .checkin-scale button[aria-pressed="true"] { background: var(--accent); color: #111; }
.checkin-step-heading h2 { margin: 0 0 4px; font-size: 24px; }
.checkin-rating { display: grid; gap: 8px; }
.checkin-scale button { min-height: 44px; border: 0; border-radius: 10px; background: var(--card-2); color: var(--text); font-weight: 600; }
.checkin-choice { width: 100%; min-height: 44px; display: flex; justify-content: space-between; align-items: center; gap: 8px; border: 0; background: none; color: var(--text); text-align: left; padding: 8px 0; }
.checkin-choice + .checkin-choice { border-top: 1px solid var(--sep); }
.checkin-choice small, .checkin-metric-grid small { display: block; color: var(--muted); }
.checkin-weight { font-size: 32px; }
.checkin-weight-week, .checkin-edit-row { border-top: 1px solid var(--sep); padding-top: 10px; }
.checkin-weight-week strong { display: block; font-size: 22px; margin-top: 4px; }
.checkin-trend { display: block; width: 100%; height: 96px; color: var(--accent); }
.checkin-metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 8px; font-size: 14px; }
.checkin-metric-grid > span { padding: 7px 0; overflow-wrap: anywhere; border-top: 1px solid var(--sep); }
.checkin-metric-grid > span:not(:nth-child(3n+1)) { text-align: right; }
.checkin-metric-grid > span:nth-child(-n+3) { border: 0; color: var(--muted); font-size: 12px; }
.checkin-sleep > :not(summary) { margin-top: 12px; }
.checkin-sleep summary { cursor: pointer; font-weight: 600; }
.checkin-sleep input[type="range"] { width: 100%; accent-color: var(--accent); }

.market-coach { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 10px;
  border: 1px solid var(--sep); align-items: start; }
.market-portrait { position: relative; display: grid; place-items: center; overflow: hidden;
  width: 76px; height: 86px; border-radius: 11px; background: var(--accent-soft); color: var(--accent);
  font-size: 21px; font-weight: 700; }
.trainer-avatar { position: relative; display: grid; place-items: center; overflow: hidden; flex-shrink: 0;
  border-radius: 50%; background: var(--accent); color: white; font-weight: 600; }
.market-portrait img, .trainer-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.market-profile-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; }
.market-profile-head .market-portrait { width: 91px; height: 103px; border-radius: 14px; }
.market-card-body, .market-summary { display: grid; align-content: start; gap: 4px; min-width: 0; }
.market-card-body { gap: 8px; }
.market-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.market-summary h2 { margin: 0; font-size: 17px; line-height: 1.2; overflow-wrap: anywhere; }
.market-focus { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.market-rating, .market-price { color: var(--muted); font-size: 12px; }
.market-rating strong, .market-price strong { color: var(--text); }
.market-price { white-space: nowrap; }
.market-price strong { font-size: 17px; }
.market-first-month { display: grid; gap: 1px; color: var(--muted); font-size: 12px; }
.market-first-month strong { color: var(--text); font-size: 17px; }
.market-first-month del, .market-ai-payment del { white-space: nowrap; }
.market-first-month del { margin-inline-start: 4px; }
.market-card-end { display: flex; justify-content: space-between; align-items: center; gap: 4px 8px; flex-wrap: wrap; }
.market-details { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 44px;
  padding: 0 10px; border: 1px solid var(--sep); border-radius: 11px; background: var(--card-2);
  color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.market-details:hover { border-color: var(--accent); }
.market-details:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 365px) {
  .market-coach .market-portrait { width: 62px; height: 76px; }
}
.market-form { display: grid; gap: 8px; }
.market-form p { margin: 0; }
.market-form textarea { display: block; width: 100%; margin-top: 6px; }
.market-ai { color: var(--accent); background: var(--accent-soft); padding: 3px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; width: fit-content; }
.market-stars { border: 0; padding: 0; margin: 0; display: flex; }
.market-stars label { position: relative; display: grid; place-items: center; width: 44px; min-height: 44px; font-size: 26px; color: var(--accent); }
.market-stars input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; }
.market-stars label:focus-within { outline: 2px solid var(--accent); border-radius: 8px; }
.market-stars-display { color: var(--accent); }
.market-comment { white-space: pre-wrap; overflow-wrap: anywhere; }

.screen.market-profile { gap: 18px; }
.market-back { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; min-height: 44px;
  padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.market-profile section { display: grid; gap: 9px; }
.market-profile h2, .market-profile p, .market-profile ul { margin: 0; }
.market-profile h2 { font-size: 19px; line-height: 1.25; }
.market-profile .market-name h2 { font-size: clamp(24px, 6vw, 30px); letter-spacing: -.035em; }
.market-profile .market-summary { gap: 7px; }
.market-profile p, .market-profile li { font-size: 16px; line-height: 1.45; overflow-wrap: anywhere; }
.market-panel { border: 1px solid var(--sep); padding: 14px; }
.market-panel ul { padding-left: 21px; }
.market-panel li + li { margin-top: 3px; }
.market-profile .market-ai-payment { padding: 14px; gap: 5px; border: 1px solid var(--sep); }
.market-ai-payment.market-ai-payment-intro {
  background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, var(--sep));
}
.market-ai-payment-label { color: var(--accent); font-weight: 650; font-size: 13px; }
.market-ai-payment-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.market-ai-payment-line > strong { font-size: clamp(32px, 10vw, 42px); line-height: 1.1; letter-spacing: -.035em; }
.market-ai-payment-line del, .market-ai-payment-terms { color: var(--muted); }
.market-ai-payment-terms { line-height: 1.45; font-size: 13px; }
.market-ai-payment-terms strong { color: var(--text); }
.market-ai-payment .btn { margin-top: 7px; min-height: 44px; width: 100%; }
.market-offer, .market-reviews header, .market-reviews header > div { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.market-offer, .market-reviews header { justify-content: space-between; }
.market-offer .market-request { background: var(--accent); color: var(--accent-ink); }
.market-profile small, .market-reviews time { font-size: 13px; color: var(--muted); }
.market-reviews article + article { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--sep); }
.market-reviews header { margin-bottom: 4px; }
.market-reviews strong { overflow-wrap: anywhere; }
.market-reviews .market-stars-display { font-size: 14px; letter-spacing: 1px; white-space: nowrap; }

.checkin-proposal { display: grid; gap: 12px; border-top: 1px solid var(--sep); padding-top: 12px; }
.checkin-proposal ul { margin: 4px 0 0; padding-inline-start: 1.25em; }
