/* Тренировочный экран под телефон: крупные зоны нажатия, графит + жёлтый Technogym */
:root {
  --bg: #f2f3f5; --surface: #ffffff; --surface-2: #eceef1; --ink: #1b1f24; --muted: #5f6873; --line: #dadde2;
  --accent: #c79500; --accent-ink: #1b1f24; --accent-soft: #fbf0c8; --ok: #2e8b57; --warn: #c0392b;
  --f-body: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-display: "Oswald", "Arial Narrow", sans-serif;
  --radius: 14px; --tab-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121418; --surface: #1c2026; --surface-2: #252a31; --ink: #eceef1; --muted: #9aa3ad; --line: #2e343c;
    --accent: #f2c01e; --accent-ink: #121418; --accent-soft: #3a3214; --ok: #4cc28a; --warn: #ff6b5b;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--f-body); }
body { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); }
button, input, textarea, select { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
a { color: var(--accent); }
.boot { padding: 40vh 0 0; text-align: center; color: var(--muted); }

/* каркас */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; background: var(--bg); }
.top h1 { font: 600 20px/1.1 var(--f-display); text-transform: uppercase; letter-spacing: .02em; margin: 0; flex: 1; min-width: 0; }
.top .sub { color: var(--muted); font-size: 13px; }
.page { max-width: 640px; margin: 0 auto; padding: 4px 16px 24px; display: grid; gap: 14px; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.tabs button { height: var(--tab-h); border: 0; background: none; display: grid; place-items: center; gap: 2px;
  font-size: 11px; color: var(--muted); padding: 8px 0 6px; }
.tabs button span { font-size: 21px; line-height: 1; }
.tabs button.on { color: var(--ink); font-weight: 600; }
.tabs button.on span { filter: none; }

/* карточки и элементы */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; min-width: 0; }
.card h2 { margin: 0; font: 600 19px/1.2 var(--f-display); text-transform: uppercase; letter-spacing: .01em; }
.card h3 { margin: 0; font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); font-size: 13px; white-space: nowrap; }
.chip.acc { background: var(--accent-soft); }
.pill-ok { color: var(--ok); font-weight: 600; }
.btn { border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 12px 14px; min-height: 46px;
  font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.big { width: 100%; min-height: 56px; font-size: 18px; }
.btn.ghost { background: none; }
.btn.danger { color: var(--warn); }
.btn.sm { min-height: 36px; padding: 6px 10px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: .5; }
.btn:focus-visible, .tabs button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
input[type=text], input[type=password], input[type=number], input[type=date], textarea, select {
  width: 100%; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 11px 12px; min-height: 46px; }
textarea { min-height: 90px; resize: vertical; }
label.f { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.err { color: var(--warn); font-size: 14px; }

/* тренировка */
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.gallery { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -14px; padding: 0 14px; scrollbar-width: none; }
.gallery::-webkit-scrollbar { display: none; }
.gallery img { flex: 0 0 78%; max-width: 78%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; scroll-snap-align: start; background: var(--surface-2); }
.gallery img.move { flex-basis: 62%; max-width: 62%; }
.target { font: 600 30px/1.1 var(--f-display); letter-spacing: .01em; }
.stepper { display: grid; grid-template-columns: 64px 1fr 64px; gap: 8px; align-items: center; }
.stepper button { height: 56px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-size: 26px; font-weight: 600; }
.stepper input { text-align: center; font: 600 26px var(--f-display); min-height: 56px; min-width: 0; }
.stepper-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.rest { position: sticky; top: calc(54px + env(safe-area-inset-top, 0px)); z-index: 15; background: var(--accent); color: var(--accent-ink);
  border-radius: var(--radius); padding: 10px 14px; display: flex; align-items: center; gap: 10px; }
.rest b { font: 600 32px/1 var(--f-display); font-variant-numeric: tabular-nums; min-width: 84px; }
.rest .btn { background: rgba(0,0,0,.12); border-color: transparent; color: inherit; }
.rest.done { background: var(--ok); color: #fff; }
.ov { display: grid; gap: 6px; }
.ov button { display: flex; align-items: center; gap: 10px; text-align: left; border: 1px solid var(--line); background: var(--surface);
  border-radius: 12px; padding: 10px 12px; min-height: 48px; }
.ov button.cur { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.ov .cnt { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; white-space: nowrap; }
.ov .ss { font-size: 11px; color: var(--muted); }
.sets { display: flex; gap: 6px; flex-wrap: wrap; }

/* шторка */
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0;
  padding: 14px 16px calc(20px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 12px; }
.sheet-head { display: flex; align-items: center; gap: 8px; position: sticky; top: -14px; background: var(--bg); padding: 4px 0; z-index: 2; }
.sheet-head h2 { flex: 1; margin: 0; font: 600 19px/1.2 var(--f-display); text-transform: uppercase; }
.answer { white-space: pre-wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.note { background: var(--accent-soft); border-radius: 10px; padding: 8px 10px; font-size: 14px; }
ul.tight { margin: 0; padding-left: 18px; display: grid; gap: 4px; }

/* чат */
.chat { display: grid; gap: 8px; }
.msg { max-width: 88%; padding: 10px 12px; border-radius: 14px; white-space: pre-wrap; }
.msg.me { justify-self: end; background: var(--accent-soft); border-bottom-right-radius: 4px; }
.msg.bot { justify-self: start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg img { border-radius: 8px; margin-bottom: 6px; max-height: 180px; }
.composer { position: sticky; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 6px); display: flex; gap: 6px; align-items: flex-end;
  background: var(--bg); padding-top: 6px; }
.composer textarea { min-height: 46px; max-height: 140px; }

/* графики */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.4; }
.chart .line2 { fill: none; stroke: var(--muted); stroke-width: 1.2; opacity: .7; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .dot { fill: var(--accent); }
.chart .bar { fill: var(--accent); }
.chart .bar.low { fill: var(--line); }
.chart .goal { stroke: var(--warn); stroke-dasharray: 4 4; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: none; border-radius: 9px; min-height: 40px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
table.list { width: 100%; border-collapse: collapse; font-size: 15px; }
table.list td { padding: 9px 4px; border-bottom: 1px solid var(--line); }
table.list td.num { text-align: right; font-variant-numeric: tabular-nums; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  background: var(--ink); color: var(--bg); padding: 12px 14px; border-radius: 12px; text-align: center; }
.login { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; display: grid; gap: 12px; }
.login h1 { font: 600 32px/1 var(--f-display); text-transform: uppercase; margin: 0 0 4px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
