:root {
  --bg: #0b0b0c;
  --panel: #161618;
  --panel-2: #222226;
  --line: #2a2b30;
  --line-strong: #4a4c53;
  --text: #f3f4f6;
  --muted: #9a9ca3;
  --accent: #98ff45;
  --danger: #ff5a4e;
  --radius: 20px;
  --display: 'Bebas', Impact, 'Arial Narrow', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  --font-num: ui-rounded, 'SF Pro Rounded', -apple-system, system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }

#app { display: flex; flex-direction: column; height: 100%; }

#view {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--safe-t) + 20px) 20px 32px;
  background: radial-gradient(900px 420px at 50% -180px, rgba(152, 255, 69, 0.10), transparent 70%), var(--bg);
}

.wrap { max-width: 760px; margin: 0 auto; }

h1 { font-family: var(--display); font-weight: normal; font-size: 52px; line-height: 1; margin: 4px 2px 16px; letter-spacing: 1px; text-transform: uppercase; }
h2 { font-family: var(--display); font-weight: normal; font-size: 24px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin: 30px 4px 10px; }

/* ---- Pasek kart ---- */
#tabbar {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 6px 8px calc(var(--safe-b) + 6px);
  background: rgba(14, 14, 16, 0.86);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
#tabbar button {
  flex: 1;
  max-width: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--muted);
  border-radius: 12px;
  min-width: 0;
}
#tabbar button > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tabbar .ti { display: grid; place-items: center; width: 52px; height: 30px; border-radius: 15px; transition: background .2s, color .2s; }
#tabbar .ti svg { width: 22px; height: 22px; }
#tabbar button.on { color: var(--text); }
#tabbar button.on .ti { background: var(--accent); color: #0b0c0d; }

/* ---- Karty ustawień ---- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 64px;
  padding: 12px 18px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row:active { background: var(--panel-2); }
.row .dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.row .lbl { flex: 1; min-width: 0; }
.row .lbl b { display: block; font-weight: 600; font-size: 17px; }
.row .lbl small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.row .val { font-family: var(--display); font-variant-numeric: tabular-nums; font-size: 32px; letter-spacing: 0.5px; }
.row .chev { color: var(--muted); font-size: 20px; }

.total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 18px 6px 0;
  color: var(--muted);
}
.total b { color: var(--text); font-family: var(--font-num); font-size: 22px; font-variant-numeric: tabular-nums; }

.actions { display: flex; gap: 12px; margin-top: 22px; }
.btn {
  flex: 1;
  height: 60px;
  border-radius: 16px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 17px;
  font-weight: 600;
}
.btn.primary { background: var(--accent); border: 0; color: #0b0c0d; font-family: var(--display); font-weight: normal; font-size: 30px; letter-spacing: 2px; box-shadow: 0 8px 28px rgba(152, 255, 69, 0.22); }
.actions.small { margin-top: 14px; }
.actions.small .btn { height: 50px; font-size: 16px; }
.btn.add { border-left: 4px solid var(--c); }
.btn.small { flex: none; height: 44px; padding: 0 16px; font-size: 15px; border-radius: 12px; }
.btn.danger { color: var(--danger); }
.btn:active { transform: scale(0.98); opacity: 0.85; }

/* ---- Lista presetów ---- */
.presets { display: grid; gap: 10px; }
.presets .empty { background: var(--panel); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.preset {
  display: flex; align-items: center; gap: 4px;
  padding: 12px 10px 12px 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.preset .name { flex: 1; min-width: 0; text-align: left; }
.preset .name b { display: block; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preset .name small { color: var(--muted); font-size: 13px; }
.preset .name .tl { margin-top: 8px; }
.icon-btn { width: 40px; height: 44px; border-radius: 12px; font-size: 18px; color: var(--muted); display: grid; place-items: center; flex: none; }
.icon-btn svg { width: 20px; height: 20px; }
.play-btn {
  flex: none; width: 52px; height: 52px; margin-left: 6px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #0b0c0d;
  box-shadow: 0 4px 16px rgba(152, 255, 69, 0.25);
}
.play-btn svg { width: 22px; height: 22px; margin-left: 3px; }
.play-btn:active { transform: scale(0.94); }
.icon-btn:active { background: var(--panel-2); }
.empty { color: var(--muted); padding: 18px; text-align: center; font-size: 15px; }

/* ---- Przełączniki ---- */
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #3a3c42; border-radius: 16px; transition: background .2s; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }

select, input[type=text] {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  max-width: 220px;
  -webkit-user-select: text;
  user-select: text;
}
input[type=range] { width: 200px; accent-color: var(--accent); }
input[type=color] { width: 44px; height: 36px; border: 0; padding: 0; background: none; border-radius: 8px; }

/* ---- Arkusz (wybór czasu) ---- */
.backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .18s ease;
}
.sheet {
  width: 100%; max-width: 560px;
  background: var(--panel);
  border-radius: 22px 22px 0 0;
  padding: 18px 20px calc(var(--safe-b) + 20px);
  animation: up .22s ease;
}
@media (min-width: 700px) {
  .backdrop { align-items: center; }
  .sheet { border-radius: 22px; }
}
.sheet h3 { margin: 0 0 4px; font-size: 20px; text-align: center; }
.sheet p { margin: 0 0 12px; color: var(--muted); text-align: center; font-size: 14px; }
.sheet .actions { margin-top: 16px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }

.wheels { display: flex; justify-content: center; align-items: center; gap: 8px; position: relative; }
.wheels .sep { font-family: var(--font-num); font-size: 34px; font-weight: 700; }
.wheels .unit { color: var(--muted); font-size: 14px; width: 30px; }
.wheel {
  height: 220px; width: 96px;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent);
  -webkit-mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent);
}
.wheel::-webkit-scrollbar { display: none; }
.wheel div {
  height: 44px; line-height: 44px;
  text-align: center;
  scroll-snap-align: center;
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: 30px; font-weight: 600;
}
.wheel .pad { scroll-snap-align: none; }
.wheels::before {
  content: ''; position: absolute; left: 0; right: 0; top: 50%;
  height: 44px; transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.07); border-radius: 12px; pointer-events: none;
}
.quick { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.quick button { background: var(--panel-2); border-radius: 10px; padding: 8px 12px; font-size: 14px; }

/* ---- Ekran treningu ---- */
@font-face {
  font-family: 'Bebas';
  src: url('../fonts/bebas-neue.ttf') format('truetype');
  font-display: block;
}

/* Szewron „>” jako maska – kolor nadaje tło elementu. */
:root { --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 60'%3E%3Cpolygon points='0,0 20,0 42,30 20,60 0,60 22,30'/%3E%3C/svg%3E"); }
.chev-strip, .rs-upnext::before {
  -webkit-mask-image: var(--chev);
  mask-image: var(--chev);
  -webkit-mask-repeat: repeat-x;
  mask-repeat: repeat-x;
  -webkit-mask-size: auto 100%;
  mask-size: auto 100%;
}

#run {
  --top-h: clamp(10px, 1.6vh, 20px);
  --nb-h: clamp(46px, 7.5vh, 90px);
  --bot-h: clamp(84px, 15vh, 180px);
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column;
  background: #000;
  color: #000;
  font-family: 'Bebas', var(--font);
}
#run[hidden] { display: none; }
#run button { color: inherit; }

/* górny pasek: postęp całego treningu */
.rs-top {
  position: relative;
  flex: none;
  height: calc(var(--top-h) + var(--safe-t));
  padding-top: var(--safe-t);
  display: flex; align-items: stretch;
  background: #000;
}
.rs-prog { position: relative; flex: 1; overflow: hidden; }
.rs-prog > div { position: absolute; top: 0; bottom: 0; left: 0; }
.rs-prog .base { right: 0; background: #2b2b2b; }
.rs-prog .fill { width: 0; background: #8d8d8d; transition: width .3s linear; }
/* panel bieżącej fazy */
.rs-phase {
  position: relative;
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--phase, #98ff45);
  transition: background-color .3s ease;
  overflow: hidden;
  text-align: center;
  container-type: size;
}
.rs-phase.flash { animation: flash .5s ease; }
/* postęp bieżącej fazy: delikatne przyciemnienie wypełniające panel od lewej */
.rs-phase::before {
  content: ''; position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.075);
  transform-origin: left; transform: scaleX(var(--pp, 0));
  pointer-events: none;
}
.rs-label, .rs-clock, .rs-paused, .rs-laps { position: relative; }
.rs-label.enter { animation: enter-l .35s cubic-bezier(.2, .9, .3, 1.2); }
.rs-clock.enter { animation: enter-c .35s cubic-bezier(.2, .9, .3, 1.2); }
.rs-clock.tick { animation: tick .45s ease-out; }
@keyframes enter-l { from { transform: translateY(-14px); opacity: 0; } }
@keyframes enter-c { from { transform: scale(0.9); opacity: 0.3; } }
@keyframes tick { from { transform: scale(1.06); } }
@keyframes flash { 0% { filter: brightness(1.8); } 100% { filter: none; } }
.rs-label {
  font-size: min(11vw, 8.5vh);
  line-height: 0.9;
  letter-spacing: 1px;
  text-transform: uppercase;
  max-width: 92%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rs-clock {
  font-size: min(54vw, 54vh);
  /* tak duży, jak pozwala panel: wysokość minus napis fazy („PAUZA” jest w rogu panelu) */
  font-size: min(59cqw, calc((100cqh - min(11vw, 8.5vh) - 6px) / 0.86));
  line-height: 0.82;
  margin-top: 0.04em;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}
.rs-clock.long { font-size: min(33vw, 40vh); font-size: min(36cqw, calc((100cqh - min(11vw, 8.5vh) - 6px) / 0.86)); }
#run.is-paused .rs-clock { animation: blink 1.2s steps(2, jump-none) infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.rs-paused { position: absolute !important; right: 18px; top: 16px; font-size: min(5vw, 4vh); line-height: 1; letter-spacing: 3px; opacity: 0; pointer-events: none; }
#run.is-paused .rs-paused { opacity: 0.75; }
.rs-laps {
  font-family: var(--font); font-weight: 700;
  font-size: min(3.6vw, 2.4vh);
  max-height: 16vh; overflow-y: auto;
  font-variant-numeric: tabular-nums;
  margin-top: 1vh;
}
.rs-laps:empty { display: none; }
.rs-laps small { font-size: 0.85em; opacity: 0.6; }

/* „Stuknij, aby włączyć dźwięk” – gdy iOS wstrzymał dźwięk */
.rs-sound {
  position: absolute; z-index: 2; left: 50%; top: 18%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.82); color: #fff !important;
  font-family: var(--font); font-size: 17px; font-weight: 700; white-space: nowrap;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  animation: pulse-s 1.6s ease-in-out infinite;
}
.rs-sound[hidden] { display: none; }
.rs-sound svg { width: 24px; height: 24px; }
@keyframes pulse-s { 50% { transform: translateX(-50%) scale(1.05); } }

.rs-icon, .rs-nav {
  position: absolute;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 50%;
}
.rs-icon, .rs-nav { background: rgba(0, 0, 0, 0.07); transition: transform .1s; }
.rs-icon:active, .rs-nav:active { background: rgba(0, 0, 0, 0.16); transform: scale(0.94); }
.rs-icon svg, .rs-nav svg { width: 26px; height: 26px; }
.rs-close { top: 10px; left: 10px; }
.rs-nav { bottom: 12px; width: 60px; height: 60px; }
.rs-nav svg { width: 32px; height: 32px; }
.rs-prev { left: 12px; }
.rs-next { right: 12px; }

/* pas „DALEJ” w kolorze następnej fazy */
.rs-upnext {
  position: relative;
  flex: none;
  height: var(--nb-h);
  border-top: 6px solid #000;
  background: var(--next, #f13729);
  color: #fff;
  overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: background-color .3s ease;
}
.rs-upnext::before {
  content: '';
  position: absolute; top: 0; bottom: 0;
  left: calc(var(--nb-h) * -0.8);
  right: 0;
  background: rgba(255, 255, 255, 0.16);
  -webkit-mask-size: calc(var(--nb-h) * 0.8) 100%;
  mask-size: calc(var(--nb-h) * 0.8) 100%;
  animation: march 1.6s linear infinite;
}
#run.is-paused .rs-upnext::before { animation-play-state: paused; }
@keyframes march { to { transform: translateX(calc(var(--nb-h) * 0.8)); } }
.rs-upnext > * { position: relative; }
.rs-upnext small {
  font-family: var(--font); font-weight: 600;
  font-size: calc(var(--nb-h) * 0.16);
  letter-spacing: 1px; text-transform: uppercase; opacity: 0.85;
}
.rs-upnext b {
  font-weight: normal;
  font-size: calc(var(--nb-h) * 0.5);
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  max-width: 94%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* tekst na jasnym tle (żółty/zielony) – ciemny */
.rs-upnext.light { color: #000; }
.rs-upnext.light::before { background: rgba(0, 0, 0, 0.08); }
.rs-upnext.light b { text-shadow: none; }

/* dolny pasek: rundy | pauza | cykle | czas do końca */
.rs-bottom {
  flex: none;
  height: calc(var(--bot-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) minmax(0, 1.9fr); align-items: center;
  background: #000;
  color: #fff;
}
.rs-count { text-align: center; line-height: 1; }
.rs-count b { display: block; font-weight: normal; font-size: min(calc(var(--bot-h) * 0.62), 12vw); font-variant-numeric: tabular-nums; }
.rs-count small { display: block; font-family: var(--font); font-size: min(12px, 2.6vw); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: #8a8a8a; margin-top: 2px; }
.rs-count.c1 b { color: #1d8cff; }
.rs-count.c2 b { color: #ffd21f; }
.rs-total { text-align: right; padding-right: min(18px, 3vw); }
.rs-total b { font-size: min(calc(var(--bot-h) * 0.78), 15vw); letter-spacing: 1px; white-space: nowrap; }
.rs-total b.long { font-size: min(calc(var(--bot-h) * 0.6), 10.5vw); }
.rs-play {
  width: min(calc(var(--bot-h) * 0.95), 20vw); height: calc(var(--bot-h) * 0.95);
  max-width: 180px;
  background: #1c1c1e;
  border-radius: 18px;
  box-shadow: inset 0 0 0 2px rgba(152, 255, 69, 0.35);
  display: grid; place-items: center;
}
.rs-play svg { width: 38%; height: 38%; color: #98ff45; }
.rs-play:active { background: #333; }

/* ---- Rozwijane sekcje Ustawień ---- */
.sec { margin-top: 12px; }
.sec summary {
  list-style: none;
  display: flex; align-items: center; gap: 12px;
  min-height: 60px; padding: 12px 18px;
  background: var(--panel);
  border-radius: var(--radius);
  cursor: pointer;
}
.sec summary::-webkit-details-marker { display: none; }
.sec summary:active { background: var(--panel-2); }
.sec[open] summary {
  border-radius: var(--radius) var(--radius) 0 0;
  background: #2c3d1c;
  border-bottom: 2px solid var(--accent);
}
.sec[open] summary:active { background: #34481f; }
.sec[open] .sec-t, .sec[open] .sec-chev { color: var(--accent); }
.sec[open] .sec-v { color: #c9d6bd; }
.sec-t { font-weight: 700; font-size: 18px; }
.sec-v { flex: 1; min-width: 0; text-align: right; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-chev { color: var(--muted); font-size: 22px; transition: transform .2s; }
.sec[open] .sec-chev { transform: rotate(90deg); }
.sec-body { padding: 0 0 6px; }
.sec[open] .sec-body > .card:first-child { border-radius: 0 0 var(--radius) var(--radius); }
.sub-h { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 18px 6px 8px; font-weight: 600; }
.mini-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-left: 5px; vertical-align: -1px; }
.num { min-width: 56px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 15px; }
.card.dim { opacity: 0.45; }
.msg { padding: 10px 10px 10px 18px; border-bottom: 1px solid var(--line); }
.msg:last-child { border-bottom: 0; }
.msg-top { display: flex; align-items: center; gap: 8px; }
.msg-top .lbl { flex: 1; min-width: 0; }
.msg-top .lbl b { display: block; font-size: 17px; font-weight: 600; }
.msg-top .lbl small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.msg-top q { color: var(--text); opacity: 0.85; }
.msg.off .msg-top .lbl { opacity: 0.45; }

/* ---- Edytor własnych kroków ---- */
.step { display: flex; align-items: center; gap: 8px; padding: 10px 8px 10px 12px; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.step input[type=text] { flex: 1; min-width: 0; max-width: none; }
.step .time { font-family: var(--display); font-variant-numeric: tabular-nums; font-size: 26px; letter-spacing: 0.5px; background: var(--panel-2); border-radius: 10px; padding: 4px 12px; }
.kind { width: 14px; height: 40px; border-radius: 7px; flex: none; background: var(--c); box-shadow: 0 0 12px color-mix(in srgb, var(--c) 45%, transparent); }

.note { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 10px 6px 0; }
.note.in-card { margin: 0; padding: 10px 18px 12px; border-bottom: 1px solid var(--line); }

/* ---- Nagłówek trybu (łączny czas, oś czasu, START) ---- */
.hero {
  position: relative;
  padding: 20px 20px 18px;
  border-radius: 24px;
  background: linear-gradient(145deg, #1d1f1b, #121313 60%);
  border: 1px solid #2c3324;
  overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; right: -60px; top: -80px; width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(152, 255, 69, 0.16), transparent 65%);
  pointer-events: none;
}
.hero-row { display: flex; align-items: center; gap: 16px; position: relative; z-index: 1; }
.hero-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hero-txt small { font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.hero-time { font-family: var(--display); font-weight: normal; font-size: clamp(64px, 17vw, 104px); line-height: 0.92; letter-spacing: 1px; font-variant-numeric: tabular-nums; margin-top: 2px; }
.hero-sum { color: #c9cbd1; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.go {
  flex: none;
  width: clamp(96px, 26vw, 128px); height: clamp(96px, 26vw, 128px);
  border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: var(--accent); color: #0b0c0d;
  box-shadow: 0 0 0 8px rgba(152, 255, 69, 0.12), 0 10px 34px rgba(152, 255, 69, 0.35);
  transition: transform .12s;
}
.go svg { width: 36%; height: 36%; margin-left: 6%; }
.go span { font-family: var(--display); font-size: clamp(20px, 5vw, 26px); letter-spacing: 2px; line-height: 1; }
.go:active { transform: scale(0.95); }

.tl { display: flex; gap: 2px; height: 14px; margin-top: 18px; border-radius: 7px; overflow: hidden; position: relative; z-index: 1; }
.tl.dense { gap: 0; }
.tl i { min-width: 0; display: block; }
.tl i.inf { background: repeating-linear-gradient(-45deg, var(--c) 0 6px, color-mix(in srgb, var(--c) 45%, #000) 6px 12px); }
.tl.mini { height: 6px; gap: 1px; margin-top: 8px; border-radius: 3px; opacity: 0.9; }

/* ---- Kafelki wartości ---- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start;
  min-height: 118px; padding: 14px 16px 12px 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  text-align: left; overflow: hidden;
  transition: transform .1s, background .15s;
}
.tile::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: var(--c); }
.tile:active { transform: scale(0.97); background: var(--panel-2); }
.tile-l { font-size: 12px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-v { font-family: var(--display); font-size: 48px; line-height: 1; margin: 6px 0 4px; letter-spacing: 0.5px; font-variant-numeric: tabular-nums; }
.tile-h { font-size: 12px; color: var(--muted); line-height: 1.3; }

/* ---- Historia ---- */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; }
.stat:first-child { background: linear-gradient(145deg, #23301a, #161618); border-color: #34481f; }
.stat small { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.stat b { font-family: var(--display); font-weight: normal; font-size: 52px; line-height: 1; margin-top: 4px; }
.stat:first-child b { color: var(--accent); }
.stat span { color: var(--muted); font-size: 13px; }
.chart { display: flex; align-items: flex-end; gap: 8px; height: 190px; padding: 16px 14px 12px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
.bar i { width: 100%; max-width: 44px; border-radius: 8px 8px 3px 3px; background: #3a3d44; }
.bar.today i { background: var(--accent); box-shadow: 0 0 16px rgba(152, 255, 69, 0.3); }
.bar-v { font-family: var(--display); font-size: 18px; color: var(--muted); min-height: 18px; }
.bar small { font-size: 12px; color: var(--muted); text-transform: uppercase; }
.bar.today small, .bar.today .bar-v { color: var(--text); }
.h-day { font-family: var(--display); font-weight: normal; font-size: 18px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin: 0; padding: 12px 18px 4px; }
.h-item { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.h-item:last-child { border-bottom: 0; }
.h-ic { flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--panel-2); color: var(--accent); }
.h-ic svg { width: 20px; height: 20px; }
.h-ic.m-rounds { color: #ff6b5e; }
.h-ic.m-stopwatch { color: #3dade7; }
.h-ic.m-custom { color: #feff3c; }
.h-txt { flex: 1; min-width: 0; }
.h-txt b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-txt small { color: var(--muted); font-size: 13px; }
.h-txt em { font-style: normal; color: #ffb347; }
.h-dur { font-family: var(--display); font-size: 28px; font-variant-numeric: tabular-nums; letter-spacing: 0.5px; }

@media (prefers-reduced-motion: reduce) {
  .rs-label.enter, .rs-clock.enter, .rs-clock.tick { animation: none; }
}

/* ---- Plany (notatki treningowe) ---- */
.plans { display: grid; gap: 10px; margin-top: 16px; }
.plans .empty { background: var(--panel); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.plan-card {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px;
  padding: 14px 18px; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform .1s;
}
.plan-card:active { transform: scale(0.98); background: var(--panel-2); }
.plan-top { display: flex; align-items: baseline; gap: 10px; }
.plan-top b { flex: 1; min-width: 0; font-family: var(--display); font-weight: normal; font-size: 30px; line-height: 1; letter-spacing: 0.5px; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-top small, .plan-meta { color: var(--muted); font-size: 13px; }
.plan-prev { color: #c9cbd1; font-size: 14px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.plan-prog { display: block; height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.plan-prog i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .25s; }

.back { color: var(--accent); font-size: 17px; font-weight: 600; padding: 6px 0; margin-bottom: 6px; }
.plan-h { word-break: break-word; }
.plan-bar { display: flex; flex-direction: column; gap: 8px; margin: 0 2px 12px; color: var(--muted); font-size: 14px; font-weight: 600; }
.plan-bar.all { color: var(--accent); }
.checklist .chk {
  display: flex; align-items: center; gap: 14px; width: 100%;
  min-height: 62px; padding: 10px 16px; text-align: left;
  border-bottom: 1px solid var(--line);
}
.checklist .chk:last-child { border-bottom: 0; }
.checklist .chk:active { background: var(--panel-2); }
.chk-n { flex: none; width: 34px; font-family: var(--display); font-size: 28px; color: var(--muted); text-align: center; }
.chk-t { flex: 1; min-width: 0; font-size: 18px; font-weight: 600; line-height: 1.3; }
.chk-box { flex: none; width: 34px; height: 34px; border-radius: 10px; border: 2px solid var(--line-strong); display: grid; place-items: center; color: transparent; transition: background .15s, border-color .15s; }
.chk-box svg { width: 22px; height: 22px; }
.chk.on .chk-box { background: var(--accent); border-color: var(--accent); color: #0b0c0d; }
.chk.on .chk-t { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 2px; }
.chk.on .chk-n { color: var(--accent); }
.plan-notes { padding: 14px 18px; white-space: pre-wrap; font-size: 16px; line-height: 1.5; -webkit-user-select: text; user-select: text; }

.fld { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.fld > span { font-size: 12px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.fld > small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.fld input[type=text], .fld textarea { max-width: none; width: 100%; font-size: 17px; padding: 12px 14px; border-radius: 14px; }
textarea {
  font: inherit; color: inherit; resize: vertical;
  background: var(--panel-2); border: 1px solid var(--line);
  line-height: 1.5;
  -webkit-user-select: text; user-select: text;
}
.btn:disabled { opacity: 0.4; }

/* wąskie telefony: 6 zakładek i zapisane treningi muszą się zmieścić */
@media (max-width: 420px) {
  #tabbar { gap: 0; padding-left: 2px; padding-right: 2px; }
  #tabbar button { font-size: 10px; letter-spacing: 0; }
  #tabbar .ti { width: 40px; }
  .preset { padding-left: 14px; gap: 0; }
  .preset .icon-btn { width: 34px; }
  .play-btn { width: 46px; height: 46px; }
}
