/* Look «B» (redesign spec, agreed 30.10): Fira Sans Condensed for numbers, Fira Sans for words, one orange accent. */
@font-face { font-family: "Fira Sans"; font-weight: 400; font-display: swap; src: url(fonts/fira-sans-cyrillic-400.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Fira Sans"; font-weight: 400; font-display: swap; src: url(fonts/fira-sans-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2190-2199, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Fira Sans"; font-weight: 500; font-display: swap; src: url(fonts/fira-sans-cyrillic-500.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Fira Sans"; font-weight: 500; font-display: swap; src: url(fonts/fira-sans-latin-500.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2190-2199, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Fira Sans"; font-weight: 600; font-display: swap; src: url(fonts/fira-sans-cyrillic-600.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Fira Sans"; font-weight: 600; font-display: swap; src: url(fonts/fira-sans-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2190-2199, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Fira Sans Condensed"; font-weight: 500; font-display: swap; src: url(fonts/fira-sans-condensed-cyrillic-500.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Fira Sans Condensed"; font-weight: 500; font-display: swap; src: url(fonts/fira-sans-condensed-latin-500.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2190-2199, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Fira Sans Condensed"; font-weight: 700; font-display: swap; src: url(fonts/fira-sans-condensed-cyrillic-700.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Fira Sans Condensed"; font-weight: 700; font-display: swap; src: url(fonts/fira-sans-condensed-latin-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2190-2199, U+2212, U+2215, U+FEFF, U+FFFD; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: #0C0B0A; color: #F2F2F3; overflow-x: hidden; }

:root {
  --bg: #0C0B0A; --card: #151517; --line: #1F1F22; --line2: #2C2C30; --fg: #F2F2F3; --mute: #8E8E93;
  --accent: #FF7A3D; --accent-ink: #140A05; --good: #34C27A; --warn: #E8B73A; --bad: #FF8A7A;
  --good-bg: #15281F; --warn-bg: #2A2210; --bad-bg: #2A1D1F; --accent-bg: #2A1A10;
  --num: "Fira Sans Condensed", "Arial Narrow", sans-serif; --text: "Fira Sans", system-ui, sans-serif;
  color-scheme: dark;
}

.home { min-height: 100vh; min-height: var(--tg-viewport-stable-height, 100vh); display: flex; flex-direction: column;
        max-width: 520px; margin: 0 auto; font-family: var(--text); }
.home main { flex: 1; padding: 20px 16px calc(80px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 520px; z-index: 5;
          display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px;
          border-top: 1px solid var(--line); background: var(--bg); padding: 4px 8px calc(4px + env(safe-area-inset-bottom)); }
.tabbar button { background: none; border: 0; color: var(--mute); font: 500 12px var(--text); padding: 12px 0; min-height: 44px; }
.tabbar button[aria-current="page"] { color: var(--fg); font-weight: 600; }
.body-stage { padding: 0; position: relative; overflow: hidden; flex: 0 0 auto;
              height: clamp(240px, calc(var(--tg-viewport-stable-height, 100svh) - 300px), 480px); }

.head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.head h1 { font: 700 30px/1.1 var(--num); margin: 0; letter-spacing: -0.01em; }
.head span { color: var(--mute); font-size: 14px; }
.cap { font-size: 12px; color: var(--mute); letter-spacing: .04em; text-transform: uppercase; }
.n { font-family: var(--num); font-weight: 700; font-variant-numeric: tabular-nums; }
.mute { color: var(--mute); }
.good { color: var(--good); } .warn { color: var(--warn); } .bad { color: var(--bad); } .acc { color: var(--accent); }

.card { background: var(--card); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card.empty { border: 1px dashed var(--line2); }
.card.tap { cursor: pointer; }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.row2 .card { border-radius: 16px; padding: 14px; gap: 6px; }
.link { background: none; border: 0; padding: 6px 0; color: var(--accent); font: 500 13px var(--text); text-align: left; cursor: pointer; }
.btn { flex: 1; height: 48px; border: 0; border-radius: 14px; background: var(--accent); color: var(--accent-ink);
       font: 600 16px var(--text); cursor: pointer; }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line2); font-weight: 500; }
.card > .btn, .sheet > .btn { flex: 0 0 auto; }
.btn.small { flex: 0 0 auto; height: 40px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btns { display: flex; gap: 8px; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.rings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ring { display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: 0; color: inherit;
        padding: 0; cursor: pointer; font: inherit; }
.ring svg { width: 104px; height: 104px; max-width: 100%; }
.ring circle.arc { transition: stroke-dashoffset .6s ease-out; }
@media (prefers-reduced-motion: reduce) { .ring circle.arc { transition: none; } }
.vitals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; text-align: center; }
.vitals .vital { background: none; border: 0; color: inherit; font: inherit; padding: 4px 0; cursor: pointer; }
.vitals b { font: 700 17px var(--num); display: block; }
.vitals small { font-size: 11px; color: var(--mute); }
.banner { background: var(--card); border-radius: 14px; padding: 12px 14px; display: flex; justify-content: space-between;
          align-items: center; gap: 10px; }
.banner div { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.banner small { font-size: 12px; color: var(--mute); }

.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; font-size: 11px; color: var(--mute); }
.week div { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.week i { width: 30px; height: 30px; box-sizing: border-box; border-radius: 50%; background: var(--line); display: flex;
          align-items: center; justify-content: center; font: 700 12px var(--num); font-style: normal; color: var(--mute); }
.week i.done { background: var(--good); color: var(--bg); }
.week i.today { background: none; border: 2px solid var(--accent); color: var(--accent); }
.week i.ahead { background: none; border: 2px dashed var(--line2); }
.week i.missed { background: var(--line2); }
.week div.now { color: var(--fg); }
.spread { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }

.title { display: flex; align-items: baseline; gap: 10px; }
.title b { font: 700 28px var(--num); }
.title span { font: 500 22px var(--num); color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--line); border-radius: 999px; padding: 6px 10px; font-size: 13px; }
.chip.o { background: none; border: 1px solid var(--line2); font-size: 12px; padding: 4px 8px; }
.changes { border-top: 1px solid var(--line); display: flex; flex-direction: column; }
.chg { display: grid; grid-template-columns: 76px minmax(0, 1fr) 16px; gap: 8px; align-items: center; padding: 9px 0;
       background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; width: 100%; }
.tag { font-size: 12px; font-weight: 600; border-radius: 6px; padding: 3px 0; text-align: center; }
.tag.good { background: var(--good-bg); } .tag.warn { background: var(--warn-bg); } .tag.bad { background: var(--bad-bg); }
.tag.mute { background: var(--line); color: var(--mute); }
.chg span { font-size: 14px; }
.more { background: var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.more p { margin: 0; font-size: 13px; color: var(--mute); }
.more .links { display: flex; gap: 16px; }

.goal svg { width: 100%; height: auto; display: block; }
.segs { display: flex; gap: 6px; } .segs i { flex: 1; height: 5px; border-radius: 3px; background: var(--line2); }
.segs i.on { background: var(--accent); }
.bar { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 5px; border-radius: 3px; background: var(--accent); }
.bar i.warn { background: var(--warn); }
.big { font: 700 22px var(--num); } .big small { font: 400 12px var(--text); color: var(--mute); }

.sheet-bg { position: fixed; inset: 0; background: rgba(12, 11, 10, .7); display: flex; align-items: flex-end; z-index: 10; }
.sheet { width: 100%; max-width: 520px; margin: 0 auto; background: var(--card); border-radius: 20px 20px 0 0;
         padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px;
         max-height: 80vh; overflow: auto; }
.sheet h2 { font: 700 20px var(--num); margin: 0; }
.sheet .opt { height: auto; min-height: 48px; padding: 12px 14px; text-align: left; }
.sheet ul { margin: 0; padding-left: 18px; font-size: 14px; display: flex; flex-direction: column; gap: 6px; }

.center { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px; text-align: center; }
.skel { background: var(--card); border-radius: 18px; height: 110px; animation: pulse 1.2s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: .5; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }

.seg { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 4px; background: var(--card); border-radius: 12px; padding: 4px; }
.seg button { white-space: nowrap; padding: 0 4px; height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--mute); font: 500 13px var(--text); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--line2); color: var(--fg); font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tiles .card { padding: 12px; gap: 4px; border-radius: 14px; }
.list { display: flex; flex-direction: column; }
.list .li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list .li:last-child { border-bottom: 0; }
.list .li div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.list .li small { font-size: 13px; color: var(--mute); }
.list .li .n { font-size: 20px; white-space: nowrap; } .list .li .n small { font: 400 12px var(--text); }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--mute); }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.hbar { display: grid; grid-template-columns: 128px minmax(0, 1fr) 40px; gap: 8px; align-items: center; font-size: 13px; }
.hbar .track { position: relative; height: 8px; border-radius: 4px; background: var(--line); }
.hbar .track i { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 4px; background: var(--good); }
.hbar .track em { position: absolute; top: -3px; bottom: -3px; border-radius: 4px; border: 1.5px solid rgba(242, 242, 243, .55); z-index: 1; }
.hbar span:last-child { text-align: right; font-family: var(--num); font-weight: 700; }

/* Compact accounting: explanations live in the sheet, not under each row. */
.muscle-row { display: grid; grid-template-columns: minmax(0, 1fr) 68px; align-items: center; gap: 14px; width: 100%; min-height: 48px; padding: 7px 0; margin: 0; background: transparent; border: 0; color: var(--fg); text-align: left; font: 500 14px/1.3 var(--text); }
.muscle-name { min-width: 0; }
.muscle-track { display: block; height: 4px; margin-top: 5px; border-radius: 3px; background: var(--line2); overflow: hidden; }
.muscle-track i { display: block; height: 100%; border-radius: inherit; background: var(--mute); }
.muscle-count { text-align: right; white-space: nowrap; font: 700 19px var(--num); }
.muscle-count span { color: var(--mute); font-weight: 500; }
.dose-legend, .dose-actions { display: flex; justify-content: space-between; gap: 12px; }
.dose-legend { color: var(--mute); font-size: 11px; margin-bottom: 3px; }
.dose-actions .link { min-height: 44px; margin-top: 4px; }
.dose-practice summary { cursor: pointer; min-height: 44px; padding: 10px 0; font-size: 14px; }

.outcome-row { display: block; width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--line2); padding: 12px 0; text-align: left; color: var(--fg); font: 400 14px/1.35 var(--text); }
.outcome-row:last-child { border-bottom: 0; }
.outcome-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.outcome-head .n { flex-shrink: 0; font-size: 17px; }
.outcome-row small { display: block; color: var(--mute); font-size: 12px; margin-top: 4px; }
