/* Wygląd aplikacji. Kolory jak w karuzelach Dawida (Instagram/marka/styl.css): grafit i cynober.
   Ciemny domyślnie, jasny, gdy telefon ma jasny motyw. Bez czerwieni jako oceny: akcent to
   przyciski i podpowiedź ciężaru, nie wynik. */

:root {
  --tlo: #141416;
  --karta: #1F1F23;
  --karta-2: #2A2A2F;
  --linia: rgba(243, 236, 224, .12);
  --tekst: #F3ECE0;
  --tekst-2: rgba(243, 236, 224, .64);
  --akcent: #E8553B;
  --akcent-tekst: #FFFFFF;
  --akcent-2: rgba(232, 85, 59, .16);
  --pole: #17171A;
  --uwaga: #F2B33D;
  --promien: 14px;
  --nav: 64px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --tlo: #F5F2ED;
    --karta: #FFFFFF;
    --karta-2: #F0ECE6;
    --linia: rgba(29, 29, 32, .12);
    --tekst: #1D1D20;
    --tekst-2: rgba(29, 29, 32, .62);
    --akcent: #D4462D;
    --akcent-2: rgba(212, 70, 45, .12);
    --pole: #FFFFFF;
    --uwaga: #9A6200;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--tlo);
  color: var(--tekst);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 26px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
p { margin: 0; }
a { color: inherit; }

.ukryte { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.opis { color: var(--tekst-2); }

/* ---------- szkielet */

.pasek-demo {
  background: var(--akcent-2);
  color: var(--tekst);
  font-size: 13px;
  text-align: center;
  padding: 6px 16px;
}

.naglowek {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--tlo);
  border-bottom: 1px solid var(--linia);
}
.naglowek-tytul { flex: 1; font-weight: 700; font-size: 20px; }
.stan {
  border: 1px solid var(--linia);
  background: var(--karta);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  color: var(--tekst-2);
}
.stan.praca { color: var(--tekst); }
.stan.uwaga { color: var(--uwaga); border-color: var(--uwaga); }
.menu {
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  padding: 6px 4px 10px 10px;
  color: var(--tekst-2);
}

.tresc {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--nav) + 32px + env(safe-area-inset-bottom));
}
.widok { display: flex; flex-direction: column; gap: 14px; }

.nawigacja {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  background: var(--karta);
  border-top: 1px solid var(--linia);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav {
  flex: 1;
  max-width: 200px;
  height: var(--nav);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 0;
  background: transparent;
  color: var(--tekst-2);
  font-size: 12px;
}
.nav.aktywny { color: var(--akcent); font-weight: 600; }
.ikona { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.karta {
  background: var(--karta);
  border-radius: var(--promien);
  padding: 14px 16px;
}
.karta.pusta { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 32px 16px; color: var(--tekst-2); }
.kolko {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid var(--linia);
  border-top-color: var(--akcent);
  animation: obrot .9s linear infinite;
}
@keyframes obrot { to { transform: rotate(360deg); } }

.przycisk {
  display: block;
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 12px;
  background: var(--akcent);
  color: var(--akcent-tekst);
  font-weight: 600;
  font-size: 17px;
  padding: 12px 16px;
}
.przycisk:disabled { opacity: .5; }
.przycisk.drugi { background: transparent; color: var(--tekst); border: 1px solid var(--linia); font-weight: 500; }
.link { border: 0; background: transparent; color: var(--akcent); padding: 8px 0; font-size: 15px; text-align: left; }
.link.maly { font-size: 14px; padding: 10px 0 0; }
.wstecz { align-self: flex-start; border: 0; background: transparent; color: var(--tekst-2); padding: 4px 0; font-size: 15px; }

input[type="text"], input[type="email"], input[type="date"], select, textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--linia);
  border-radius: 10px;
  background: var(--pole);
  padding: 10px 12px;
  font-size: 17px;
  outline: none;
}
textarea { resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus { border-color: var(--akcent); }

/* ---------- logowanie */

.logowanie {
  max-width: 420px;
  margin: 0 auto;
  min-height: 85vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 24px 16px;
}
.logo img { border-radius: 16px; display: block; }
.logowanie .kod { font-size: 26px; letter-spacing: .3em; text-align: center; }
.blad:empty { display: none; }
.blad { color: var(--uwaga); }
.linki { display: flex; justify-content: space-between; }

/* ---------- trening */

.tydzien {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--tekst-2);
  font-size: 14px;
}
.kropki { display: flex; gap: 6px; }
.kropka {
  min-width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  background: var(--karta-2);
  color: var(--tekst-2);
}
.kropka.pelna { background: var(--akcent); color: var(--akcent-tekst); }
.kropka.dzis { box-shadow: inset 0 0 0 2px var(--tekst-2); }
.kropka.mala { min-width: 12px; width: 12px; height: 12px; }

.wybor-jednostki { display: flex; flex-direction: column; gap: 10px; }
.jednostka {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  width: 100%;
  border: 1px solid var(--linia);
  border-radius: var(--promien);
  background: var(--karta);
  padding: 14px 16px;
}
.jednostka.proponowana { border-color: var(--akcent); }
.jednostka-gora { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.jednostka-nazwa { font-weight: 700; font-size: 18px; }
.znaczek { background: var(--akcent-2); color: var(--akcent); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; }
.jednostka-cwiczenia { color: var(--tekst-2); font-size: 14px; }
.jednostka-ost { color: var(--tekst-2); font-size: 13px; }
.wiersz-daty { display: flex; align-items: center; gap: 12px; color: var(--tekst-2); font-size: 15px; }
.wiersz-daty input { flex: 1; }

.blok { display: flex; flex-direction: column; gap: 12px; }
.blok-naglowek { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.blok-naglowek .wstecz { flex-basis: 100%; }
.data-bloku input { min-height: 40px; padding: 6px 10px; font-size: 15px; width: auto; }

.cwiczenie {
  background: var(--karta);
  border-radius: var(--promien);
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cw-gora { display: flex; align-items: flex-start; gap: 10px; }
.cw-nr {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--karta-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}
.cwiczenie.zrobione .cw-nr { background: var(--akcent); color: var(--akcent-tekst); }
.cw-nazwa { flex: 1; font-size: 17px; padding-top: 3px; overflow-wrap: anywhere; }
.film {
  flex: none;
  text-decoration: none;
  color: var(--akcent);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--akcent);
  border-radius: 999px;
  padding: 4px 12px;
}
.cw-rozpiska { font-size: 15px; }
.cw-wskazowka { color: var(--tekst-2); font-size: 14px; }
.cw-ostatnio { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--tekst-2); font-size: 14px; }
.podpowiedz { background: var(--akcent-2); color: var(--akcent); border-radius: 999px; padding: 2px 10px; font-weight: 600; }

.serie { display: grid; grid-template-columns: repeat(var(--kolumny, 4), minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
.pole { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pole-etykieta { font-size: 12px; color: var(--tekst-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.liczba {
  text-align: center;
  font-size: 20px !important;
  font-weight: 600;
  padding: 8px 4px !important;
  min-height: 52px !important;
}
.liczba::placeholder { color: var(--tekst-2); opacity: .45; font-weight: 400; }
.liczba.zle { border-color: var(--uwaga) !important; }
.drugi-ciezar { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--linia); }

.notatka { display: flex; flex-direction: column; gap: 6px; color: var(--tekst-2); font-size: 14px; }
.koniec { display: flex; flex-direction: column; gap: 10px; text-align: center; padding-top: 4px; }

.historia { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.historia h3 { color: var(--tekst-2); font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.hist {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  background: var(--karta);
  padding: 12px 14px;
  text-align: left;
}
.hist-data { color: var(--tekst-2); white-space: nowrap; }

/* ---------- ankiety */

.tydzien-dziennika { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.tydzien-dziennika .kropki { width: 100%; justify-content: space-between; }

.formularz { display: flex; flex-direction: column; gap: 16px; }
.sekcja { font-size: 19px; padding-top: 10px; border-top: 1px solid var(--linia); margin-top: 4px; }
.sekcja:first-of-type { border-top: 0; }
.pomoc { color: var(--tekst-2); font-size: 14px; margin-top: -10px; }
.pytanie .pomoc { margin-top: 0; }
.pytanie { display: flex; flex-direction: column; gap: 8px; }
.pytanie-tytul { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 600; }
.wymagane { color: var(--akcent); }
.wyslane { flex: none; color: var(--tekst-2); font-weight: 400; font-size: 13px; }

.wybory { display: flex; flex-wrap: wrap; gap: 8px; }
.wybor {
  border: 1px solid var(--linia);
  background: var(--karta);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 15px;
  text-align: left;
}
.wybor.wl, .punkt.wl, .przelacznik .wl { background: var(--akcent); border-color: var(--akcent); color: var(--akcent-tekst); }
.wybory .inne { flex-basis: 100%; }

.skala { display: flex; flex-direction: column; gap: 6px; }
.punkty { display: grid; grid-template-columns: repeat(var(--punkty, 5), minmax(0, 1fr)); gap: 6px; }
.punkt { min-height: 46px; border: 1px solid var(--linia); background: var(--karta); border-radius: 10px; font-weight: 600; padding: 0; }
.skala-opis { display: flex; justify-content: space-between; gap: 12px; color: var(--tekst-2); font-size: 13px; }

.przelacznik { display: grid; grid-template-columns: 1fr 1fr; gap: 0; background: var(--karta); border-radius: 12px; padding: 4px; }
.przelacznik button { border: 0; background: transparent; border-radius: 9px; min-height: 44px; font-size: 15px; }

/* ---------- komunikaty */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav) + 16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 30;
  max-width: min(92vw, 520px);
  background: var(--tekst);
  color: var(--tlo);
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 15px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
  transition: opacity .5s;
}
.toast.uwaga { background: var(--uwaga); color: #1D1D20; }
.toast.znika { opacity: 0; }

.arkusz-tlo { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .5); display: flex; align-items: flex-end; justify-content: center; }
.arkusz {
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--karta);
  border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.arkusz-tytul { font-weight: 700; font-size: 18px; }
.nieudany { border: 1px solid var(--linia); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.nieudany pre { margin: 0; white-space: pre-wrap; font: 13px/1.4 ui-monospace, Consolas, monospace; color: var(--tekst-2); }
.wersja { color: var(--tekst-2); font-size: 12px; text-align: center; }
