/* Karta Typera S5: wspólne style aplikacji. Ciemny motyw (bez granatu) z tłem w ciepłym odcieniu nawierzchni toru, układ i fonty jak w s4.
   Kolor tylko na danych (pąkty, drużyny, stany) i na głównej akcji; reszta w odcieniach szarości.
   Zaokrąglenia: karty 8 px, kontrolki 6 px, znaczniki 4 px, koła dla awatarów. Cienie tylko na tym, co pływa. */

:root {
  color-scheme: dark;
  --tlo: #13100d;
  --karta: #1c1814;
  --ramka: #2e2721;
  --ramka-pola: #42392f;
  --pole: #251f1a;
  --pole-ciemne: #161310;
  --linia: #2a241e;
  --tekst: #f5f1ec;
  --tekst-2: #d3cbc1;
  --szary: #ab9f92;
  --akcent: #f5a524;
  --akcent-tlo: rgba(245, 165, 36, .1);
  --na-akcencie: #1a1204;
  --ok: #7ee2a0;
  --warn: #ffc25c;
  --zle: #ff9a9a;
  --gosp: #7fb2ff;
  --gosc: #ff9f92;
  --r-karta: 8px;
  --r-pole: 6px;
  --r-znak: 4px;
  --font: 'Barlow', system-ui, sans-serif;
  --font-num: 'Barlow Condensed', 'Barlow', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--tlo); color: var(--tekst); font: 16px/1.4 var(--font); }
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--akcent); outline-offset: 2px;
}
[hidden] { display: none !important; }
a { color: var(--akcent); }

.ekran { max-width: 480px; margin: 0 auto; padding: 0 14px 40px; }
.num { font-family: var(--font-num); font-weight: 700; font-variant-numeric: tabular-nums; }
.maly { font-size: 14px; color: var(--szary); }
.etykieta { font-size: 14px; font-weight: 600; color: var(--szary); margin: 24px 0 8px; }
.ok { color: var(--ok); } .warn { color: var(--warn); } .zle { color: var(--zle); }
.ikona { width: 20px; height: 20px; flex: none; color: var(--szary); }

.karta { background: var(--karta); border: 1px solid var(--ramka); border-radius: var(--r-karta); padding: 16px; margin: 0 0 14px; }
/* Sekcje karty wyraźnie oddzielone (nie zlewają się przy przewijaniu). */
.karta.sekcja { margin-bottom: 32px; }
.karta h2 { margin: 0 0 8px; font-family: var(--font-num); font-weight: 700; font-size: 20px; }
.baner { padding: 12px 14px; border-radius: var(--r-karta); margin: 0 0 14px; border: 1px solid; }
.baner.zle { background: #2a1214; border-color: #5c2229; }
.baner.info { background: #2a2210; border-color: #5c4a1c; color: var(--warn); }

label { display: block; margin-bottom: 12px; font-size: 14px; color: var(--szary); }
label > input, label > textarea, label > select { display: block; margin-top: 4px; }
input[type=text], input[type=password], input[type=url], textarea, select {
  width: 100%; min-height: 44px; border-radius: var(--r-pole); border: 1px solid var(--ramka-pola);
  background: var(--pole-ciemne); padding: 8px 12px; font-size: 16px; color: var(--tekst);
}
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--akcent); outline: none; }

.przycisk {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border-radius: var(--r-pole); border: 1px solid var(--ramka-pola); background: var(--pole); font-weight: 600; text-decoration: none; color: var(--tekst);
}
.przycisk.glowny { background: var(--akcent); border-color: var(--akcent); color: var(--na-akcencie); }
.przycisk.szeroki { width: 100%; }
.przycisk:disabled { opacity: .5; cursor: not-allowed; }
.przycisk.maly-p { min-height: 36px; padding: 0 12px; font-size: 14px; }

/* Pasek górny (przyklejony) */
.pasek {
  position: sticky; top: 0; z-index: 5; background: var(--tlo); padding: 12px 0 10px;
  border-bottom: 1px solid var(--ramka); margin-bottom: 14px; display: flex; align-items: flex-start; gap: 10px;
}
.pasek .tytul { flex: 1; min-width: 0; }
.pasek .tytul .num { font-size: 24px; line-height: 1.1; }
.pasek .prawa { text-align: right; font-size: 14px; }
.wstecz {
  width: 44px; height: 44px; flex: none; border-radius: 50%; border: 1px solid var(--ramka-pola);
  background: var(--pole); font-size: 20px; line-height: 1; padding: 0;
}

/* Logowanie */
.logowanie { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; }
.logo { width: 72px; height: 72px; border-radius: var(--r-karta); background: var(--akcent); color: var(--na-akcencie); display: flex;
  align-items: center; justify-content: center; margin: 0 auto 12px; font-family: var(--font-num); font-weight: 700; font-size: 28px; }
.logowanie h1 { text-align: center; font-family: var(--font-num); font-size: 30px; margin: 0 0 20px; }
.link-l { display: block; margin: 0 auto 14px; min-height: 44px; padding: 0 12px; border: 0; background: none; color: var(--akcent); font-size: 15px; text-decoration: underline; }

/* Start: znak aplikacji (owal toru) i nazwa nad powitaniem */
.marka { display: flex; align-items: center; gap: 8px; padding-top: 16px; }
.marka .znak { width: 68px; height: 40px; color: var(--akcent); flex: none; }
.marka .nazwa-marki { font-family: var(--font-num); font-weight: 700; font-size: 18px; }
.logo .znak-logo { width: 44px; height: 44px; }

/* Start */
.powitanie { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0 4px; }
.powitanie .czesc { margin: 0; font-family: var(--font-num); font-weight: 700; font-size: 28px; line-height: 1.1; }
.kolejka-info { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; margin-top: 8px; font-size: 14px; color: var(--tekst-2); }
.kolejka-info > span { white-space: nowrap; }
/* „Moje typy”: jedyna główna akcja ekranu, stąd ramka i strzałka w kolorze akcentu. */
.moje-typy {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; margin-top: 18px;
  padding: 18px; border-radius: var(--r-karta); border: 1px solid var(--akcent); background: var(--karta); text-align: left;
}
.moje-typy .duzy { font-family: var(--font-num); font-weight: 700; font-size: 26px; line-height: 1; }
.moje-typy .maly { margin-top: 4px; }
.moje-typy > div:first-child { flex: 1; min-width: 0; }
/* Odliczanie jak na tablicy wyników: największa liczba na Starcie */
.odliczanie { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.odliczanie .maly { margin: 0; font-size: 12px; }
.licznik { font-size: 30px; line-height: 1; color: var(--akcent); white-space: nowrap; }
.moje-typy .strzalka { width: 48px; height: 48px; border-radius: var(--r-pole); background: var(--akcent); color: var(--na-akcencie);
  display: flex; align-items: center; justify-content: center; flex: none; }
.moje-typy .strzalka .ikona { width: 24px; height: 24px; color: inherit; }

.gracze { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.gracz {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: var(--r-karta);
  border: 1px solid var(--ramka); background: var(--karta); min-height: 44px; font-size: 13px; font-weight: 600;
}
/* Zablokowany do zamknięcia typowania: czytelny (powód stoi nad listą), tylko przygaszony. */
.gracz:disabled { cursor: not-allowed; color: var(--szary); background: var(--tlo); }
.gracz:disabled .awatar { opacity: .5; }
.gracz .nick { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.awatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--pole-ciemne);
  border: 1px solid var(--ramka-pola); color: #54493e; display: block; }

/* Strefa ligi: lista modułów w jednej karcie (wiersze rozdzielone linią) */
.lista-m { padding: 0 16px; }
.wiersz-m { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 0; border: 0;
  border-top: 1px solid var(--linia); background: none; text-align: left; font-weight: 600; }
.wiersz-m:first-child { border-top: 0; }
.wiersz-m .nazwa-m { flex: 1; min-width: 0; }
.wiersz-m .dalej { width: 18px; height: 18px; }

/* Karta */
.sekcja-szkic { display: flex; align-items: center; gap: 10px; }
.sekcja-szkic .no { font-family: var(--font-num); font-weight: 700; font-size: 24px; color: var(--szary); line-height: 1; }

/* Tabela podglądu */
.tabela-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 6px 6px; border-bottom: 1px solid var(--linia); text-align: left; vertical-align: top; }
td.liczba, th.liczba { text-align: right; font-variant-numeric: tabular-nums; }

/* Okno komunikatu (uciążliwy komunikat profilu) */
.okno-tlo { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .8); display: flex; align-items: center; justify-content: center; padding: 20px; }
.okno { max-width: 400px; width: 100%; background: var(--karta); border: 1px solid var(--ramka-pola); border-radius: var(--r-karta); padding: 20px; }
.okno h2 { margin: 0 0 8px; font-family: var(--font-num); font-size: 24px; }
.okno .przyciski { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

.ladowanie { padding: 40px 0; text-align: center; color: var(--szary); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Szkielet ładowania: płaskie szare bloki w miejscu treści, lekko pulsujące (bez przesuwanego gradientu) */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sz-blok { background: var(--pole); border-radius: var(--r-znak); animation: sz-puls 1.4s ease-in-out infinite; }
.sz-tytul { height: 20px; width: 45%; margin-bottom: 14px; }
.sz-wiersz { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.sz-linia { height: 14px; flex: none; max-width: calc(100% - 56px); }
.sz-kolo { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.sz-wiersz:not(:has(.sz-kolo)) .sz-linia { max-width: 100%; }
@keyframes sz-puls { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .sz-blok { animation: none; } }

/* Komputer: więcej miejsca, więc cały widok ok. 20% większy (telefon bez zmian). */
@media (min-width: 1000px) and (min-height: 700px) and (hover: hover) {
  html { zoom: 1.2; }
}

/* Kręciołek w przycisku podczas dłuższej akcji */
.kreci { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent;
  display: inline-block; animation: kreci .8s linear infinite; flex: none; }
@keyframes kreci { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .kreci { animation-duration: 2.4s; } }

/* Regulamin (Szczegółowe zasady) */
.regulamin-wrap > h1 { font-family: var(--font-num); font-size: 26px; text-align: center; margin: 4px 0 14px; }
.spis-r ol { margin: 0; padding-left: 22px; line-height: 1.9; }
.spis-r a { text-decoration: none; }
.regulamin { line-height: 1.55; scroll-margin-top: 80px; }
.regulamin h2 { scroll-margin-top: 84px; }
.regulamin h3 { font-family: var(--font-num); font-size: 18px; margin: 18px 0 6px; color: var(--tekst); }
.regulamin p { margin: 8px 0; color: var(--tekst-2); }
.regulamin ul { margin: 6px 0; padding-left: 20px; color: var(--tekst-2); }
.regulamin li { margin: 5px 0; }
.regulamin li ul { margin: 4px 0; }
.regulamin strong { color: var(--tekst); }
.regulamin blockquote { margin: 10px 0; padding: 8px 12px; border-left: 3px solid var(--ramka-pola); background: var(--pole-ciemne); border-radius: 0 var(--r-pole) var(--r-pole) 0; }
.regulamin .tabela-wrap { overflow-x: auto; margin: 8px 0; }
