/* Ekran treningu. Telefon leży na podłodze albo krześle, patrzysz na niego
   z dwóch metrów — wszystko, co liczy się w trakcie ćwiczenia, musi być
   czytelne z tej odległości. Stąd wielkości w jednostkach ekranu. */
:root {
  --bg: #12141a;
  --card: #1c1f28;
  --card-2: #242834;
  --text: #f2f5f9;
  --muted: #8b93a5;
  --line: #2e3342;
  --akcent: #0a84ff;
  --czerwony: #ff453a;
  --zielony: #32d74b;
  --bursztyn: #ffd60a;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  overscroll-behavior: none;
}
#app { min-height: 100%; }

/* ---------- wspólne ---------- */
.ekran {
  min-height: 100dvh; display: flex; flex-direction: column;
  padding: calc(14px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
}
.srodek { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.mini { font-size: .82rem; letter-spacing: .12em; text-transform: uppercase;
        color: var(--muted); font-weight: 700; }
.znacznik.mini, .wyzwalacze .mini { font-size: .68rem; }

button {
  appearance: none; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card-2); color: var(--text);
  font-family: inherit; font-size: 1.1rem; font-weight: 600; line-height: 1;
  padding: 15px 18px; cursor: pointer; width: 100%;
}
button.glowny { background: var(--akcent); border-color: var(--akcent); color: #fff;
                font-size: 1.2rem; padding: 19px 18px; }
button:disabled { opacity: .4; }
input, select {
  width: 100%; background: var(--card-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 17px 16px; font-family: inherit; font-size: 1.3rem; font-weight: 600;
}
label.pole > .mini { font-size: .74rem; }
label.pole { display: block; margin-bottom: 14px; }
label.pole > .mini { display: block; margin-bottom: 6px; }
.blad { background: rgba(255,69,58,.14); border: 1px solid var(--czerwony);
        color: #ffb3ae; border-radius: 10px; padding: 12px; margin-bottom: 14px; font-size: .9rem; }
.stopka { text-align: center; color: var(--muted); font-size: .7rem; padding-top: 14px; }

/* ---------- wybór ---------- */
.tytul { font-size: 1.9rem; font-weight: 800; margin: 0 0 22px; letter-spacing: -.02em; }
.wybory { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; }
.wybory button { text-align: left; font-weight: 600; font-size: 1.2rem; padding: 18px; }
.wybory button.on { border-color: var(--akcent); background: rgba(10,132,255,.16); }

/* ---------- ekran treningu ---------- */
.pasek { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.pasek .blok { font-size: 1.7rem; font-weight: 700; color: var(--text);
                letter-spacing: -.02em; line-height: 1.1; }
.seria { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; }
.seria b { font-size: 2.1rem; }

.nazwa-cwiczenia {
  font-size: clamp(2rem, 11vw, 4.2rem); font-weight: 800;
  line-height: 1.02; letter-spacing: -.03em; margin: 0 0 4px;
  overflow-wrap: anywhere;
}
.dalej-podglad { color: var(--muted); font-size: 1.2rem; margin-top: 10px; }

.wielka-liczba {
  font-size: clamp(5rem, 34vw, 12rem); font-weight: 800;
  line-height: .95; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums; text-align: center; margin: 10px 0;
}
.jednostka { text-align: center; color: var(--muted); font-size: 1.25rem; margin-top: 2px; }
.jednostka b { color: var(--text); font-weight: 700; }
.zegar.odliczanie { color: var(--czerwony); }
.zegar.nadmiar { color: var(--zielony); }
.zegar.przerwa { color: var(--bursztyn); }

.licznik { display: flex; align-items: center; justify-content: center; gap: 14px; }
.licznik button { width: 78px; height: 78px; border-radius: 50%; font-size: 2rem; padding: 0; flex: none; }

.nastepny { margin-top: 18px; }
.nastepny button { padding: 26px 18px; font-size: 1.3rem; font-weight: 800; letter-spacing: .04em; }

.wyzwalacze { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.znacznik {
  font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 700;
  color: var(--muted); background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 11px;
}
.znacznik.dziala { color: var(--zielony); border-color: rgba(50,215,75,.45); }
.znacznik.padl { color: var(--czerwony); border-color: rgba(255,69,58,.45); }

/* ---------- podsumowanie ---------- */
.podsumowanie { font-size: 1rem; }
.podsumowanie .duze { font-size: 2.6rem; font-weight: 800; margin: 6px 0 18px; }
.wiersz { display: flex; justify-content: space-between; gap: 12px;
          padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.wiersz span:last-child { color: var(--muted); white-space: nowrap; }

/* ---------- odliczanie przed blokiem ---------- */
.kolo { position: relative; width: min(62vw, 300px); margin: 12px auto 6px; }
.kolo svg { width: 100%; transform: rotate(-90deg); }
.kolo circle { fill: none; stroke-width: 7; stroke-linecap: round; }
.kolo .tor { stroke: var(--card-2); }
.kolo .wskaz { stroke: var(--akcent); transition: stroke-dashoffset .2s linear; }
.kolo-liczba {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: clamp(4rem, 22vw, 8rem); font-weight: 800; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}

/* ---------- pauza ---------- */
.nastepny { display: flex; gap: 10px; }
.nastepny button#nast { flex: 1; }
.nastepny button#pauza {
  width: 84px; flex: none; padding: 0; background: var(--card-2);
  display: flex; align-items: center; justify-content: center;
}
.nastepny button#pauza svg { display: block; }
.nastepny button#pauza.wstrzymany { background: var(--bursztyn); border-color: var(--bursztyn); color: #12141a; }

/* ---------- wskaźnik nasłuchu ---------- */
.wyzwalacze { flex-wrap: wrap; }
.znacznik { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
            text-transform: none; letter-spacing: .02em; }
.znacznik.czeka { color: var(--bursztyn); border-color: rgba(255,214,10,.45); }

/* ---------- blokada obracania ---------- */
/* iOS ignoruje ustawienie orientacji z manifestu, więc w poziomie po prostu
   zasłaniamy aplikację prośbą o obrót — ćwiczy się wyłącznie w pionie. */
#obroc { display: none; }
@media (orientation: landscape) and (max-height: 560px) {
  #app { display: none; }
  #obroc {
    display: flex; align-items: center; justify-content: center; text-align: center;
    min-height: 100dvh; padding: 24px; font-size: 1.4rem; font-weight: 700; color: var(--muted);
  }
}

/* ---------- plakietka z liczbą uruchomień ---------- */
.plakietka-rzad { display: flex; margin-top: 8px; }
.plakietka {
  background: rgba(10,132,255,.16); border: 1px solid rgba(10,132,255,.45);
  color: #7cc0ff; border-radius: 999px; padding: 5px 12px;
  font-size: .82rem; font-weight: 700; letter-spacing: .02em;
}

/* ---------- ocena zmęczenia ---------- */
.tarcza { position: relative; width: min(72vw, 260px); margin: 10px auto 4px; }
.tarcza svg { width: 100%; display: block; }
.tarcza-srodek { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; }
.tarcza-liczba { font-size: 3.4rem; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.tarcza-slowo { color: var(--muted); font-size: .95rem; margin-top: 2px; }

.suwak-rzad { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.suwak-rzad button.krok {
  width: 62px; height: 62px; flex: none; border-radius: 50%;
  font-size: 1.7rem; font-weight: 700; padding: 0;
}
.suwak-skala { display: flex; justify-content: space-between;
               color: var(--muted); font-size: .78rem; margin-top: 6px; }

input[type=range] {
  -webkit-appearance: none; appearance: none;
  flex: 1; height: 34px; padding: 0; border: 0; background: transparent;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 10px; border-radius: 5px; background: var(--card-2); border: 1px solid var(--line);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 34px; height: 34px; margin-top: -13px; border-radius: 50%;
  background: var(--akcent); border: 3px solid var(--bg);
  box-shadow: 0 2px 8px rgba(0,0,0,.45);
}
input[type=range]::-moz-range-track {
  height: 10px; border-radius: 5px; background: var(--card-2); border: 1px solid var(--line);
}
input[type=range]::-moz-range-thumb {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--akcent); border: 3px solid var(--bg);
}

textarea {
  width: 100%; background: var(--card-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; padding: 14px;
  font-family: inherit; font-size: 1.05rem; resize: vertical;
}
.podsumowanie .pole { margin-bottom: 18px; }

/* ---------- komunikat o stanie zapisu ---------- */
.uwaga {
  background: rgba(255,214,10,.12); border: 1px solid rgba(255,214,10,.45);
  border-radius: 12px; padding: 14px; margin-bottom: 12px;
  font-size: .95rem; line-height: 1.45; color: var(--text);
}
.uwaga b { color: var(--bursztyn); }
.uwaga-akcja { margin-top: 10px; font-size: 1rem; padding: 12px; }

/* ---------- kontrolka połączenia z bazą ---------- */
.kulka {
  display: inline-block; width: 13px; height: 13px; border-radius: 50%;
  vertical-align: middle; margin-left: 8px; cursor: pointer;
  background: var(--muted); box-shadow: 0 0 0 3px rgba(139,147,165,.14);
  transition: background .2s ease, box-shadow .2s ease;
}
.kulka.jest { background: var(--zielony); box-shadow: 0 0 0 3px rgba(50,215,75,.16); }
.kulka.brak { background: var(--czerwony); box-shadow: 0 0 0 3px rgba(255,69,58,.18); }

/* Przerwa dostaje ten sam pierścień co odliczanie, tylko w barwie czekania. */
.kolo.przerwa .wskaz { stroke: var(--bursztyn); }
.uwaga .uwaga-akcja + .uwaga-akcja { margin-top: 6px; }

/* Odłożone wpisy to nie ostrzeżenie, tylko problem — inny kolor niż czekanie. */
.uwaga.zle { background: rgba(255,69,58,.12); border-color: rgba(255,69,58,.5); }
.uwaga.zle b { color: #ff8b8b; }

/* Cofanie stoi po lewej, wyraźnie mniejsze od NASTĘPNY — ma być pod ręką,
   ale nigdy nie konkurować o kciuk z przyciskiem, którego używa się co krok. */
.nastepny button.wstecz {
  width: 66px; flex: none; font-size: 1.5rem; font-weight: 700;
  background: var(--card); color: var(--muted); padding: 0;
}
.nastepny button.wstecz:disabled { opacity: .3; }
