/* Setka: aplikacja */
body { min-height: 100dvh; touch-action: manipulation; }
.view {
  max-width: 560px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 16px calc(32px + env(safe-area-inset-bottom));
  outline: none;
}
h1, h2 { font-family: var(--font-display); font-weight: 800; line-height: 1.08; margin: 0; letter-spacing: .01em; }
h2 { font-size: 28px; }
p { margin: 0; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 14px; margin-top: 12px; }

/* Kolor ćwiczenia: --acc tło, --on-acc tekst na tym tle */
.acc-blue, .tile--blue, .hero--blue, .tap--blue, body[data-accent="blue"] { --acc: #2F3BFF; --on-acc: #FFFFFF; --on-acc-soft: rgba(255,255,255,.86); }
.acc-yellow, .tile--yellow, .hero--yellow, .tap--yellow, body[data-accent="yellow"] { --acc: #FFC83D; --on-acc: #10123A; --on-acc-soft: rgba(16,18,58,.82); }
.acc-mint, .tile--mint, .hero--mint, .tap--mint, body[data-accent="mint"] { --acc: #2BD4A0; --on-acc: #10123A; --on-acc-soft: rgba(16,18,58,.82); }
.acc-violet, .tile--violet, .hero--violet, .tap--violet, body[data-accent="violet"] { --acc: #6A4CF0; --on-acc: #FFFFFF; --on-acc-soft: rgba(255,255,255,.88); }

/* Pasek górny */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; }
.bar-title { font-weight: 700; color: var(--muted); font-size: 15px; text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); flex: none; }
.brand .tally { width: 30px; height: auto; }
.brand span { font-family: var(--font-display); font-weight: 900; font-size: 30px; letter-spacing: .02em; }
.back {
  display: inline-flex; align-items: center; gap: 4px; padding: 8px 10px 8px 2px; flex: none;
  background: none; border: 0; color: var(--text); text-decoration: none; font-weight: 700; cursor: pointer;
}
.bar-actions { display: flex; gap: 6px; align-items: center; }
.bar-actions .btn { gap: 6px; }

/* Przyciski */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 22px; border-radius: 999px; border: 2px solid transparent;
  font-weight: 700; font-size: 17px; text-decoration: none; cursor: pointer; text-align: center;
  transition: transform .08s ease;
}
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--text); color: var(--bg); }
body[data-accent] .btn--primary { background: var(--acc, var(--text)); color: var(--on-acc, var(--bg)); }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn--danger { background: transparent; border-color: var(--warn); color: var(--warn); }
.btn--sm { min-height: 42px; padding: 6px 16px; font-size: 15px; }
.btn--xl { min-height: 64px; font-size: 20px; }
.btn--block { display: flex; width: 100%; margin-top: 18px; }
.btn--icon { padding: 6px; min-width: 42px; }
.btn[hidden] { display: none; }
.round {
  width: 56px; height: 56px; flex: none; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: var(--surface); border: 2px solid var(--line); color: var(--text);
}
.round--sm { width: 46px; height: 46px; }

/* Ekran główny */
.home-title { font-size: clamp(40px, 12vw, 64px); margin: 14px 0 18px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  display: grid; align-content: start; gap: 6px; padding: 16px 14px 14px; border-radius: var(--r-lg);
  text-decoration: none; position: relative; overflow: hidden; min-width: 0;
  background: var(--acc); color: var(--on-acc); container-type: inline-size;
  transition: transform .1s ease;
}
.tile:active { transform: scale(.98); }
.tile-name { font-family: var(--font-display); font-weight: 900; font-size: min(17cqi, 40px); line-height: 1.05; min-width: 0; white-space: nowrap; }
.tile-score { font-family: var(--font-display); font-weight: 800; font-size: 18px; white-space: nowrap; }
.tile-score b { font-size: min(30cqi, 56px); font-weight: 900; line-height: 1; }
.tile-score span { opacity: .7; }
.tile-tally { margin-top: 2px; }
.tile-tally .tally { display: block; width: 100%; height: auto; max-height: 64px; }
.tile-status { font-size: 13px; font-weight: 700; color: var(--on-acc-soft); line-height: 1.3; margin-top: 2px; }

/* Ekran ćwiczenia */
.hero { border-radius: var(--r-lg); padding: 20px 18px; margin-bottom: 14px; background: var(--acc); color: var(--on-acc); }
.hero-name { font-size: clamp(42px, 13vw, 64px); font-weight: 900; }
.hero-score { font-family: var(--font-display); font-weight: 800; font-size: 22px; margin: 6px 0 14px; }
.hero-score b { font-size: 68px; font-weight: 900; line-height: .9; margin-right: 6px; }
.hero-score span { opacity: .75; display: inline-block; white-space: nowrap; }
.hero-tally .tally { display: block; max-height: 140px; width: auto; max-width: 100%; }

.card { background: var(--surface); border-radius: var(--r-lg); padding: 20px 18px; margin-top: 14px; border: 1px solid var(--line); }
.card p { margin-top: 10px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; }
.card-head .muted { font-size: 15px; }
.card--flag { border: 2px solid var(--text); }
.note { padding: 12px 14px; border-radius: var(--r-sm); background: var(--chalk-2); font-size: 15px; }

.chips { list-style: none; padding: 0; margin: 16px 0 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.chip { display: grid; justify-items: center; gap: 2px; padding: 10px 2px; border-radius: var(--r-sm); background: var(--chalk-2); min-width: 0; }
.chip b { font-family: var(--font-display); font-size: 30px; font-weight: 900; line-height: 1; white-space: nowrap; }
.chips--time .chip b { font-size: 21px; }
.chip span { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.2; white-space: nowrap; }
.chip--max { background: var(--text); color: var(--bg); }
.chip--max span { color: inherit; opacity: .75; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 0; }
.stats div { padding: 14px 12px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.stats dt { font-size: 13px; color: var(--muted); }
.stats dd { margin: 4px 0 0; font-family: var(--font-display); font-size: 28px; font-weight: 900; line-height: 1.05; overflow-wrap: anywhere; }
.stats--4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 520px) { .stats--4 { grid-template-columns: repeat(4, 1fr); } }

.block { margin-top: 26px; }
.block > h2 { margin-bottom: 10px; }
.hist { list-style: none; margin: 0; padding: 0; }
.hist-row {
  display: grid; grid-template-columns: 74px 1fr auto; grid-template-areas: "date what total" "date sets total";
  column-gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); align-items: center;
}
.hist-date { grid-area: date; color: var(--muted); font-size: 14px; }
.hist-what { grid-area: what; font-weight: 700; }
.hist-sets { grid-area: sets; color: var(--muted); font-size: 14px; }
.hist-total { grid-area: total; font-family: var(--font-display); font-size: 30px; font-weight: 900; }
.hist-row--cal { grid-template-columns: 1fr auto; grid-template-areas: "date total" "what total" "sets total"; }
.hist-row--cal .hist-date { color: var(--text); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.hist-row--cal .hist-what { font-weight: 400; color: var(--muted); font-size: 14px; }
.card .hist-row:first-child { border-top: 0; }
.hist-date .mk { width: 12px; height: 12px; }

.fold { border-top: 1px solid var(--line); padding-top: 14px; }
.fold summary { font-family: var(--font-display); font-size: 28px; font-weight: 800; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: "+"; font-size: 30px; color: var(--muted); }
.fold[open] summary::after { content: "–"; }
.tips { padding-left: 22px; margin: 12px 0 0; }
.tips li { margin-bottom: 8px; }
.field { display: grid; gap: 6px; margin-top: 14px; font-weight: 700; font-size: 15px; min-width: 0; }
.field input, .field select {
  min-height: 52px; padding: 10px 14px; border-radius: var(--r-sm); width: 100%;
  border: 2px solid var(--line); background: var(--surface); font-size: 18px; font-weight: 400;
}

/* Jak to robić */
.how-motion { margin-top: 12px; padding: 8px 6px 0; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.how .tips { margin-top: 14px; }
.how-muscles { margin-top: 10px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); padding: 14px 16px; }
.how-muscles summary { font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 28px; }
.how-muscles summary::-webkit-details-marker { display: none; }
.how-muscles summary::after { content: "+"; font: 800 26px var(--font-display); color: var(--muted); }
.how-muscles[open] summary::after { content: "–"; }
.how-map { max-width: 360px; margin: 12px auto 4px; }

/* Trening */
.setline { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 0; margin: 6px 0 0; }
.setline li { height: 44px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--chalk-2); color: var(--muted); min-width: 0; }
.setline b { font-family: var(--font-display); font-size: 22px; font-weight: 900; white-space: nowrap; }
.setline li.done { background: var(--text); color: var(--bg); }
.setline li.now { background: var(--acc); color: var(--on-acc); }

.stage { display: grid; justify-items: center; text-align: center; padding-top: 24px; }
.stage > p { max-width: 42ch; }
.stage-label { font-family: var(--font-display); font-size: 28px; font-weight: 800; line-height: 1.1; }
.big {
  font-family: var(--font-display); font-weight: 900; line-height: .85;
  font-size: clamp(130px, 46vw, 220px); letter-spacing: -.01em; margin: 14px 0 6px;
  font-variant-numeric: tabular-nums;
}
.big--timer { font-size: clamp(96px, 34vw, 170px); }
.pop { animation: pop .16s ease-out; }
@keyframes pop { from { transform: scale(1.12); } to { transform: scale(1); } }
.stepper { display: flex; align-items: center; justify-content: center; gap: 14px; width: 100%; }
.stepper .muted { min-width: 110px; font-size: 15px; }
.row { display: flex; gap: 10px; justify-content: center; align-items: center; width: 100%; margin-top: 18px; }
.row .btn { flex: 1; padding-left: 12px; padding-right: 12px; }
.drain { width: 100%; height: 10px; border-radius: 99px; background: var(--chalk-2); overflow: hidden; margin: 6px 0 16px; }
.drain span { display: block; height: 100%; background: var(--acc, var(--text)); transform-origin: left; transition: transform .2s linear; }

.stage--count { padding-top: 14px; }
.tap {
  width: 100%; min-height: 42dvh; margin-top: 14px; border: 0; border-radius: var(--r-lg);
  display: grid; place-content: center; justify-items: center; cursor: pointer;
  background: var(--acc); color: var(--on-acc);
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.tap .big { margin: 0; }
.tap-hint { font-weight: 700; opacity: .85; padding: 0 12px; }
.tap:active { filter: brightness(1.08); }

.verdict { margin-top: 18px; padding: 14px 16px; border-radius: var(--r-sm); font-weight: 700; text-align: left; width: 100%; max-width: none !important; }
.verdict--ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.verdict--no { background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--warn); }

/* Wpisanie wyniku zamiast liczenia */
.type-in { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; font-weight: 700; font-size: 15px; color: var(--muted); }
.type-in input {
  width: 96px; min-height: 52px; padding: 8px 10px; text-align: center;
  border: 2px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--text);
  font-family: var(--font-display); font-weight: 900; font-size: 30px; font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.type-in input::-webkit-outer-spin-button, .type-in input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.type-in input:focus { border-color: var(--text); outline: none; }

/* Toast */
.toast {
  position: fixed; left: 0; right: 0; margin: 0 auto; width: fit-content; max-width: calc(100% - 32px); z-index: 30;
  bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateY(20px);
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 22px; font-weight: 700;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; text-align: center;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* Łącznie zrobione */
.totals { margin-top: 26px; }
.totals h2 { margin-bottom: 10px; }
.totals-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.total {
  display: grid; gap: 2px; padding: 14px 14px 14px 16px; border-radius: var(--r-sm); text-decoration: none; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  border-left: 6px solid var(--acc);
}
.total--blue { --acc: #2F3BFF; }
.total--yellow { --acc: #FFC83D; }
.total--mint { --acc: #2BD4A0; }
.total--violet { --acc: #6A4CF0; }
.total b { font-family: var(--font-display); font-weight: 900; font-size: clamp(32px, 9.5vw, 48px); line-height: 1.05; font-variant-numeric: tabular-nums; white-space: nowrap; }
.total span { color: var(--muted); font-size: 15px; }

/* Znaczniki dni */
.mk { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.mk--blue { background: #2F3BFF; }
.mk--yellow { background: #FFC83D; }
.mk--mint { background: #2BD4A0; }
.mk--violet { background: #6A4CF0; }
.mk--ink { background: var(--text); }
.mk--test { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px currentColor; }
.mk--plan { background: transparent !important; border: 2px solid; }
.mk--plan.mk--blue { border-color: #2F3BFF; }
.mk--plan.mk--yellow { border-color: #E0A800; }
.mk--plan.mk--mint { border-color: #1FB585; }
.mk--plan.mk--violet { border-color: #6A4CF0; }
.mk--plan.mk--ink { border-color: var(--text); }
.mk--none { background: var(--line); width: 6px; height: 6px; }

/* Pasek 14 dni */
.strip-link { display: block; margin-top: 18px; padding: 14px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--text); }
.strip-head { display: flex; justify-content: space-between; font-weight: 700; font-size: 15px; }
.strip { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(14, 1fr); gap: 2px; }
.strip li { display: grid; justify-items: center; align-content: end; gap: 6px; min-height: 44px; min-width: 0; }
.strip-mks { display: grid; gap: 2px; justify-items: center; }
.strip li > span:last-child { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.strip li.today > span:last-child { color: var(--text); font-weight: 700; }

/* Kalendarz */
.segs { display: flex; gap: 6px; margin-top: 4px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.segs::-webkit-scrollbar { display: none; }
.seg { padding: 8px 14px; border-radius: 999px; border: 2px solid var(--line); text-decoration: none; color: var(--text); font-weight: 700; font-size: 15px; white-space: nowrap; background: none; cursor: pointer; font-family: inherit; }
.seg--on { background: var(--text); color: var(--bg); border-color: var(--text); }
.segs--full .seg { flex: 1; padding-left: 8px; padding-right: 8px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 12px; }
.cal-title { font-size: clamp(28px, 8.4vw, 42px); text-align: center; white-space: nowrap; }
.cal-title span { color: var(--muted); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cw { text-align: center; font-size: 13px; color: var(--muted); font-weight: 700; padding-bottom: 4px; }
.cd {
  aspect-ratio: 1 / 1.1; min-width: 0; border-radius: 10px; border: 2px solid transparent;
  background: var(--surface); color: var(--text); cursor: pointer; padding: 4px 1px;
  display: grid; grid-template-rows: 1fr auto; justify-items: center; align-items: center;
  font-variant-numeric: tabular-nums;
}
.cd > span:first-child { font-weight: 700; font-size: 15px; }
.cd .mks { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; min-height: 9px; max-width: 100%; }
.cd .mk { width: 7px; height: 7px; }
.cd--blank { background: none; border: 0; cursor: default; }
.cd--rest {
  background: repeating-linear-gradient(135deg, var(--chalk-2) 0 4px, transparent 4px 8px), var(--surface);
  color: var(--muted);
}
.cd--train { background: var(--surface); border-color: var(--line); }
.cd--today > span:first-child { background: var(--text); color: var(--bg); border-radius: 999px; padding: 0 7px; }
.cd--sel { border-color: var(--text); }
.legend { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.lg-rest { width: 14px; height: 14px; border-radius: 4px; background: repeating-linear-gradient(135deg, var(--line) 0 3px, transparent 3px 6px); border: 1px solid var(--line); }
.cal-day { font-size: 26px; margin-bottom: 4px; }
.cal-day::first-letter { text-transform: uppercase; }

/* Kamienie milowe */
.ms-label { font-size: 14px; color: var(--muted); font-weight: 700; margin: 12px 0 6px !important; }
.ms-row { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ms { min-width: 52px; padding: 8px 12px; border-radius: 999px; border: 2px dashed var(--line); text-align: center; color: var(--muted); }
.ms b { font-family: var(--font-display); font-size: 21px; font-weight: 900; line-height: 1; white-space: nowrap; }
.ms--on { border-style: solid; border-color: var(--text); background: var(--text); color: var(--bg); }

/* Stopka */
.credit { margin-top: 28px; font-size: 14px; color: var(--muted); text-align: center; }
.credit a, .fine a { color: inherit; font-weight: 700; }
.page-title { font-size: clamp(40px, 12vw, 56px); margin: 10px 0 4px; }

/* Udostępnianie */
.share-frame { margin: 8px auto 0; display: grid; place-items: center; }
.share-frame canvas { display: block; height: auto; border-radius: 18px; box-shadow: 0 18px 40px rgba(16,18,58,.18); background: var(--chalk-2); }
.share-frame--story canvas { width: min(100%, 290px); aspect-ratio: 9 / 16; }
.share-frame--post canvas { width: min(100%, 360px); aspect-ratio: 4 / 5; }
.share-opts { display: grid; gap: 12px; margin-top: 18px; justify-items: center; }
.share-opts .segs { margin: 0; }
.share-opts .seg:not(.seg--on) { background: none; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 2px var(--line); cursor: pointer; }
.swatch--blue { background: #2F3BFF; }
.swatch--yellow { background: #FFC83D; }
.swatch--mint { background: #2BD4A0; }
.swatch--violet { background: #6A4CF0; }
.swatch--ink { background: #10123A; }
.swatch--on { box-shadow: 0 0 0 3px var(--text); }

/* Przypomnienia */
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 14px; }
.day {
  min-height: 48px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface);
  font-weight: 700; cursor: pointer; font-family: inherit; padding: 0; min-width: 0;
}
.day--on { background: var(--text); color: var(--bg); border-color: var(--text); }
.card .row { margin-top: 14px; }

/* Profil i waga */
.fields3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.unit-in { position: relative; display: block; }
.unit-in input { padding-right: 34px !important; }
.unit-in i { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); font-size: 14px; font-weight: 700; pointer-events: none; }
.wstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 6px; }
.wstats div { display: grid; min-width: 0; }
.wstats b { font-family: var(--font-display); font-weight: 900; font-size: 34px; line-height: 1.05; white-space: nowrap; }
.wstats span { font-size: 13px; color: var(--muted); }
.wchart { display: block; width: 100%; height: auto; margin-top: 8px; }
.wc-grid { stroke: var(--line); stroke-width: 1; }
.wc-lbl { font: 700 11px var(--font-body); fill: var(--muted); }
.wc-area { fill: var(--blue); opacity: .1; }
.wc-line { fill: none; stroke: var(--blue); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.wc-dot { fill: var(--surface); stroke: var(--blue); stroke-width: 2.5; }
.wadd { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 16px; }
.wadd input { min-height: 52px; width: 100%; padding: 10px 14px; border-radius: var(--r-sm); border: 2px solid var(--line); background: var(--surface); font-size: 18px; }
.wlist { list-style: none; padding: 0; margin: 14px 0 0; }
.wlist li { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 15px; }
.wlist b { font-variant-numeric: tabular-nums; }
.xbtn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; }

.field-label { font-weight: 700; font-size: 15px; margin: 16px 0 6px !important; }
.goals { list-style: none; padding: 0; margin: 12px 0 0; }
.goals li { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name val" "name sug"; align-items: center; column-gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.goals li > span:first-child { grid-area: name; display: flex; align-items: center; gap: 8px; font-weight: 700; }
.goals li > span:first-child .mk { width: 10px; height: 10px; }
.goals b { grid-area: val; text-align: right; font-family: var(--font-display); font-size: 26px; font-weight: 900; line-height: 1; }
.goals li > span:last-child { grid-area: sug; text-align: right; font-size: 13px; }

/* Wąskie ekrany */
@media (max-width: 400px) {
  .btn--cal span { display: none; }
  .btn--cal { padding: 6px; min-width: 42px; }
  .brand span { font-size: 26px; }
  .stage-label { font-size: 24px; }
  .fields3 { grid-template-columns: 1fr 1fr; }
  .fields3 .field:last-child { grid-column: 1 / -1; }
  .wstats b { font-size: 28px; }
  .chip span { font-size: 11px; }
  .chips { gap: 4px; }
}

@media (min-width: 720px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .tile { padding: 20px 18px 18px; }
  .totals-row { grid-template-columns: repeat(4, 1fr); }
  .view { max-width: 820px; }
  body:not([data-view="home"]) .view { max-width: 560px; }
}


/* ---------- Pasek zakładek ---------- */
body[data-tabs="1"] .view { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.tabbar {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 20;
  width: min(100%, 560px); display: grid; grid-template-columns: 1fr 1fr;
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabbar a { display: grid; justify-items: center; gap: 2px; padding: 6px 0; text-decoration: none; color: var(--muted); font-weight: 700; font-size: 13px; border-radius: 14px; }
.tabbar a.on { color: var(--text); background: var(--chalk-2); }
body[data-tabs="1"] .toast { bottom: calc(86px + env(safe-area-inset-bottom)); }

/* ---------- Szybkie akcje i seria ---------- */
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.quick-btn {
  display: grid; gap: 2px; padding: 12px 14px; border-radius: var(--r-sm); text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-family: inherit;
}
.quick-btn b { font-size: 16px; }
.quick-btn span { font-size: 13px; color: var(--muted); }
.streak {
  display: grid; grid-template-columns: auto 1fr; grid-template-areas: "ico main" "ico sub" "bars bars";
  column-gap: 12px; row-gap: 2px; align-items: center; margin-top: 12px; padding: 14px 16px;
  border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none;
}
.streak-ico { grid-area: ico; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, #FF7A3D 18%, transparent); color: #E8601E; }
.streak-main { grid-area: main; font-weight: 700; }
.streak-main b { font-family: var(--font-display); font-size: 30px; font-weight: 900; margin-right: 2px; }
.streak-sub { grid-area: sub; font-size: 13px; color: var(--muted); }
.streak-bars { grid-area: bars; display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; align-items: end; height: 34px; margin-top: 10px; }
.streak-bars i { display: block; height: calc(8px + var(--h) * 26px); border-radius: 4px; background: var(--chalk-2); }
.streak-bars i.on { background: #E8601E; }
.streak-bars i.cur { outline: 2px solid var(--text); outline-offset: 1px; }

/* ---------- Wyzwania ---------- */
.chlist { list-style: none; padding: 0; margin: 0; }
.chlist a { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: baseline; padding: 12px 0; border-top: 1px solid var(--line); color: var(--text); text-decoration: none; }
.chlist span { font-size: 14px; }
.vs-list { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; }
.vs { display: grid; gap: 4px; padding: 14px 16px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--acc); }
.vs-name { font-family: var(--font-display); font-weight: 800; font-size: 24px; }
.vs-row { display: grid; grid-template-columns: 76px 1fr 46px; gap: 8px; align-items: center; font-size: 14px; font-weight: 700; }
.vs-row > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-row b { text-align: right; font-family: var(--font-display); font-size: 20px; }
.vs-bar { height: 10px; border-radius: 99px; background: var(--chalk-2); overflow: hidden; }
.vs-bar i { display: block; height: 100%; background: var(--muted); border-radius: 99px; }
.vs-row--me .vs-bar i { background: var(--acc); }
.vs-val { font-size: 12px; color: var(--muted); padding-left: 84px; margin-top: -2px; }

/* ---------- Ekran ćwiczenia: cel, rozgrzewka ---------- */
.card--goal { background: var(--acc); color: var(--on-acc); border: 0; }
.card--goal .btn--primary, body[data-accent] .card--goal .btn--primary { background: var(--on-acc); color: var(--acc); }
.link-warm { display: block; text-align: center; margin-top: 12px; font-weight: 700; font-size: 15px; color: var(--text); }
.warm-list { list-style: none; padding: 0; margin: 16px 0 0; counter-reset: w; }
.warm-list li { display: flex; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); counter-increment: w; }
.warm-list li span::before { content: counter(w) ". "; color: var(--muted); }
.warm-motion { width: 100%; max-width: 360px; margin: 6px auto 0; }
.warm-clock { margin-top: 8px; }

/* ---------- Ekran powitalny ---------- */
.ob { padding-top: 8px; }
.ob-dots { display: flex; gap: 6px; justify-content: center; margin: 4px 0 18px; }
.ob-dots i { width: 28px; height: 6px; border-radius: 99px; background: var(--line); }
.ob-dots i.on { background: var(--text); }
.ob-hero { width: 64px; margin-bottom: 8px; }
.ob-hero .tally { width: 100%; height: auto; }
.ob .card { margin-top: 16px; }
.fields2 { grid-template-columns: 1fr 1fr !important; }
.fields2 .field:last-child { grid-column: auto !important; }
.ob-ex { display: grid; gap: 10px; margin-top: 16px; }
.ob-card {
  position: relative; display: grid; gap: 4px; text-align: left; padding: 16px 52px 16px 16px; border-radius: var(--r-lg);
  border: 2px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; font-family: inherit;
}
.ob-card b { font-family: var(--font-display); font-size: 30px; font-weight: 900; line-height: 1.05; }
.ob-card span { font-size: 14px; color: var(--muted); }
.ob-card i { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-style: normal; font-weight: 900; }
.ob-card.on { border-color: var(--acc); background: color-mix(in srgb, var(--acc) 10%, var(--surface)); }
.ob-card.on i { background: var(--acc); border-color: var(--acc); color: var(--on-acc); }

/* ---------- Profil: widoczne ćwiczenia ---------- */
.exvis { display: grid; gap: 8px; margin-top: 12px; }
.exvis-btn { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-sm); border: 2px solid var(--line); background: var(--surface); color: var(--text); font-weight: 700; cursor: pointer; font-family: inherit; }
.exvis-btn span { margin-left: auto; font-size: 13px; color: var(--muted); }
.exvis-btn:not(.on) { opacity: .6; }
.exvis-btn .mk { width: 12px; height: 12px; }

/* ---------- Kalendarz: wpisy ---------- */
.mk--gym { background: var(--text); border-radius: 2px; }
.mk--extra { background: transparent; border: 2px solid var(--muted); }
.cd--restplan { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--chalk-2) 55%, transparent) 0 4px, transparent 4px 8px), var(--surface); }
.lg-rest--plan { opacity: .5; }
.addentry { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.addentry summary { font-weight: 700; cursor: pointer; }
.hist-total .xbtn { display: inline-grid; vertical-align: middle; margin-left: 4px; width: 30px; height: 30px; }
.hist-sets a { color: var(--text); font-weight: 700; }

/* ---------- Siłownia ---------- */
.search { display: block; margin-top: 12px; }
.search input { width: 100%; min-height: 52px; padding: 10px 16px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); font-size: 17px; }
.search input:focus { outline: none; border-color: var(--text); }
.gcat section { margin-top: 18px; }
.gcat h2 { font-size: 24px; margin-bottom: 4px; }
.gcat ul { list-style: none; padding: 0; margin: 0; }
.gx { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.gx[hidden], .gcat section[hidden] { display: none; }
.gx a { display: grid; gap: 2px; text-decoration: none; color: var(--text); min-width: 0; }
.gx a b { font-weight: 700; }
.gx a span { font-size: 13px; color: var(--muted); }
.gx-btn { width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer; font-weight: 900; font-size: 18px; }
.gx-btn.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.gx-btn--add { background: var(--blue); color: #fff; border-color: var(--blue); }
.gx-empty { margin-top: 16px; }
.glist { list-style: none; padding: 0; margin: 10px 0 0; }
.glist a { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name best" "meta best"; gap: 2px 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--text); }
.glist-name { grid-area: name; font-weight: 700; }
.glist-meta { grid-area: meta; font-size: 13px; color: var(--muted); }
.glist-best { grid-area: best; display: grid; justify-items: end; }
.glist-best b { font-family: var(--font-display); font-size: 22px; font-weight: 900; line-height: 1; white-space: nowrap; }
.glist-best small { font-size: 11px; color: var(--muted); }
.hist-row--link { color: var(--text); text-decoration: none; }
.hist li { list-style: none; }
.chipline { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px !important; }
.chipline span { padding: 4px 12px; border-radius: 999px; background: var(--chalk-2); font-size: 13px; font-weight: 700; }
.gsess-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; }
.gsess-time { display: grid; justify-items: end; }
.gsess-time b { font-family: var(--font-display); font-size: 34px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.gsess-time small { font-size: 12px; color: var(--muted); }
.gcard { margin-top: 14px; padding: 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.gcard-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.gcard-head a { font-family: var(--font-display); font-size: 24px; font-weight: 800; color: var(--text); text-decoration: none; line-height: 1.1; }
.gcard .fine { margin-top: 6px; }
.gsets { margin-top: 10px; display: grid; gap: 6px; }
.gset { display: grid; grid-template-columns: 40px 1fr 1fr 52px; gap: 8px; align-items: center; }
.gset > span:first-child { text-align: center; font-weight: 700; color: var(--muted); }
.gset--head span { font-size: 12px; color: var(--muted); font-weight: 700; text-align: center; }
.gset input {
  width: 100%; min-width: 0; min-height: 48px; padding: 6px 8px; text-align: center; border-radius: var(--r-sm);
  border: 2px solid var(--line); background: var(--bg); color: var(--text); font-family: var(--font-display); font-size: 24px; font-weight: 900;
  -moz-appearance: textfield;
}
.gset input::-webkit-outer-spin-button, .gset input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.gset input:focus { outline: none; border-color: var(--text); }
.gcheck { height: 48px; border-radius: var(--r-sm); border: 2px solid var(--line); background: var(--surface); color: var(--muted); font-size: 20px; font-weight: 900; cursor: pointer; }
.gset.done input { background: color-mix(in srgb, var(--ok) 10%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.gset.done .gcheck { background: var(--ok); border-color: var(--ok); color: #fff; }
.gcard-foot { display: flex; gap: 8px; margin-top: 10px; }
.grest {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 25;
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 18px; border-radius: 999px;
  background: var(--text); color: var(--bg); box-shadow: 0 10px 30px rgba(16,18,58,.25); font-weight: 700;
}
.grest[hidden] { display: none; }
.grest b { font-family: var(--font-display); font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; min-width: 52px; }
.grest button { border: 0; border-radius: 999px; padding: 8px 12px; background: color-mix(in srgb, var(--bg) 18%, transparent); color: inherit; font-weight: 700; cursor: pointer; font-family: inherit; }
.gpast { margin: 8px 0 0; padding-left: 22px; }
.gpast li { padding: 2px 0; font-variant-numeric: tabular-nums; }
.tiles--one { grid-template-columns: 1fr; }


/* ---------- Plan treningowy ---------- */
.tabbar { grid-template-columns: repeat(3, 1fr); }
.pq { margin-top: 22px; }
.pq h2 { display: flex; align-items: center; gap: 10px; font-size: 24px; }
.pq h2 span { width: 28px; height: 28px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; font-size: 16px; flex: none; }
.pq > .muted { font-size: 14px; margin-top: 4px; }
.pchips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pchip { min-height: 46px; padding: 8px 16px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); color: var(--text); font-weight: 700; font-size: 15px; cursor: pointer; font-family: inherit; }
.pchip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.pnext { border: 2px solid var(--text); }
.pnext-k { font-size: 13px; font-weight: 700; color: var(--muted); margin: 0 !important; }
.pnext h2 { font-size: 32px; margin-top: 2px; }
.pnext-list { list-style: none; padding: 0; margin: 12px 0 0; }
.pnext-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 15px; }
.pnext-list b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.plist { list-style: none; padding: 0; margin: 12px 0 0; }
.pitem { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.pitem a { display: grid; gap: 2px; color: var(--text); text-decoration: none; min-width: 0; }
.pitem a span { font-size: 14px; font-weight: 700; color: var(--muted); }
.pitem a small { font-size: 12px; color: var(--muted); }
.pswap { min-height: 40px; padding: 6px 12px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); color: var(--text); font-weight: 700; font-size: 13px; cursor: pointer; font-family: inherit; }
.pbars { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 6px; }
.pbars li { display: grid; grid-template-columns: 112px 1fr 28px; gap: 8px; align-items: center; font-size: 14px; }
.pbars i { display: block; height: 10px; border-radius: 99px; background: linear-gradient(to right, var(--blue) var(--w), var(--chalk-2) var(--w)); }
.pbars b { text-align: right; font-variant-numeric: tabular-nums; }
.pcard { display: grid; gap: 4px; margin-top: 12px; padding: 16px; border-radius: var(--r-sm); border: 2px solid var(--text); background: var(--surface); color: var(--text); text-decoration: none; }
.pcard b { font-family: var(--font-display); font-size: 24px; font-weight: 800; line-height: 1.1; }
.pcard span { font-size: 14px; color: var(--muted); }
.pcard i { font-style: normal; font-weight: 700; font-size: 15px; margin-top: 4px; text-decoration: underline; text-underline-offset: 3px; }
.pcard--new { background: var(--text); color: var(--bg); }
.pcard--new span { color: color-mix(in srgb, var(--bg) 80%, transparent); }
.gtarget { display: inline-block; margin-top: 6px !important; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--blue) 14%, transparent); color: var(--text); font-weight: 700; font-size: 13px; }

/* Targeted training/accessibility fixes; preserve the existing visual system. */
.backup-field { display: grid; gap: 6px; margin-block: 14px; font-weight: 700; }
.backup-field input { width: 100%; min-height: 48px; border: 2px solid var(--line); border-radius: 12px; padding: 10px; background: var(--surface); color: var(--text); font: inherit; }
.backup-check { display: flex; gap: 12px; align-items: center; margin-block: 16px; min-height: 48px; }
.backup-check input { width: 24px; height: 24px; flex-shrink: 0; }
.backup-conflict { border-block-start: 2px solid var(--line); margin-block: 20px; padding-block: 12px; }
.backup-conflict pre { max-height: 240px; overflow: auto; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.storage-warning { padding: 16px; background: var(--text); color: var(--bg); }
.resume-workout { margin-bottom: 16px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
.xbtn, .grest button, .pswap { min-width: 44px; min-height: 44px; }
.big, .grest b { font-variant-numeric: tabular-nums; }
#backup-panel { overflow-wrap: anywhere; }
#update-setka { position: relative; z-index: 30; width: calc(100% - 32px); max-width: 620px; margin: 16px auto calc(100px + env(safe-area-inset-bottom)); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
