/* Style gry w bowling - kolorystyka na wzór kręgielni (granatowe banery, białe litery, jasne drewno) */
:root {
  --granat: #161925;
  --granat-2: #23273a;
  --bialy: #f4f2ee;
  --drewno: #e2c48f;
  --akcent: #3b8fe0;
  --czerwony: #e0393b;
  --szary: #9aa0ab;
  --font-baner: 'Black Ops One', 'Arial Black', Impact, sans-serif;
  --font: 'Roboto Condensed', 'Segoe UI', Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--granat);
  color: var(--bialy);
  font-family: var(--font);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

#scena {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  touch-action: none; /* dotyk działa jak kliknięcie, bez przewijania */
}

/* ---------- Tablica wyników ---------- */
.tablica {
  position: fixed;
  top: max(6px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: min(760px, calc(100vw - 12px));
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(9, minmax(0, 1fr)) minmax(0, 1.4fr) minmax(0, 1.3fr);
  background: #e9edf5;
  color: #1b2235;
  border: 2px solid #0e1018;
  border-radius: 6px;
  overflow: hidden;
  font-size: clamp(10px, 2.6vw, 15px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .45);
  pointer-events: none;
}
.tablica .kom {
  border-right: 1px solid #a8b0c2;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.tablica .kom:last-child { border-right: 0; }
.tablica .naglowek {
  background: #2c3f74;
  color: #fff;
  text-align: center;
  font-weight: 700;
  padding: 1px 0;
  font-size: .85em;
}
.tablica .znaki {
  display: flex;
  justify-content: flex-end;
  height: 1.5em;
}
.tablica .znaki span {
  flex: 0 1 1.35em;
  min-width: 0;
  text-align: center;
  border-left: 1px solid #a8b0c2;
  border-bottom: 1px solid #a8b0c2;
  font-weight: 700;
  line-height: 1.5em;
}
.tablica .suma-ramki {
  text-align: center;
  font-weight: 700;
  line-height: 1.6em;
  min-height: 1.6em;
}
.tablica .nick-kol {
  justify-content: center;
  padding: 0 4px;
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  background: #d7deec;
}
.tablica .nick-kol .naglowek { margin: 0 -4px; }
.tablica .nick-kol .tekst { line-height: 3.1em; overflow: hidden; text-overflow: ellipsis; }
.tablica .aktywna { background: #fff4c9; }
.tablica .total { background: #2c3f74; color: #fff; }
.tablica .total .suma-ramki { font-size: 1.35em; line-height: 2.2em; }

/* ---------- Monitor kręgli ---------- */
.monitor {
  position: fixed;
  right: 10px;
  top: calc(max(6px, env(safe-area-inset-top)) + 4.4em + 14px);
  width: clamp(92px, 18vw, 160px);
  aspect-ratio: 160 / 130;
  border: 4px solid #0b0c10;
  border-radius: 6px;
  background: linear-gradient(160deg, #7ec6ef, #b7e3f7 55%, #9fd3f1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .5);
  pointer-events: none;
}
.monitor canvas { width: 100%; height: 100%; display: block; }

/* ---------- Panel kroku ---------- */
.panel {
  position: fixed;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 16px));
  background: rgba(22, 25, 37, .9);
  border: 1px solid #3a4160;
  border-radius: 10px;
  padding: 10px 12px;
  text-align: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .5);
}
.panel .krok {
  font-family: var(--font-baner);
  letter-spacing: 1px;
  font-size: 15px;
  color: #ffd76a;
}
.panel p { margin: 4px 0 8px; font-size: 15px; }
.panel .wiersz {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
.panel .wartosc {
  min-width: 120px;
  font-weight: 700;
  font-size: 17px;
}

.przycisk {
  font-family: var(--font);
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  background: var(--akcent);
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 2px 0 #1f5e9e;
}
.przycisk:active { transform: translateY(1px); box-shadow: none; }
.przycisk.szary { background: #4a5170; box-shadow: 0 2px 0 #2c3148; }
.przycisk.duzy { font-size: 19px; padding: 12px 26px; }
.przycisk:focus-visible { outline: 3px solid #ffd76a; outline-offset: 2px; }

/* ---------- Mierniki ---------- */
.miernik {
  position: fixed;
  background: rgba(22, 25, 37, .9);
  border: 1px solid #3a4160;
  border-radius: 10px;
  padding: 8px;
  text-align: center;
  pointer-events: none;
}
.miernik-tytul { font-family: var(--font-baner); font-size: 13px; color: #ffd76a; }
.miernik-wartosc { font-weight: 700; margin-top: 4px; }
.miernik-pasek { position: relative; border: 2px solid #0b0c10; border-radius: 6px; }
.miernik-wskaznik { position: absolute; background: #fff; border: 2px solid #0b0c10; border-radius: 3px; box-shadow: 0 0 6px #fff; }

.miernik-pion {
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 74px;
}
.miernik-pion .miernik-pasek {
  height: min(42vh, 300px);
  width: 30px;
  margin: 6px auto 0;
  /* od zielonego (dół, lekki rzut) do czerwonego (góra, mocny rzut) */
  background: linear-gradient(to top, #2bb24c 0%, #a5d13b 35%, #f3d23a 60%, #f08a2a 80%, #e0393b 100%);
}
.miernik-pion .miernik-wskaznik { left: -8px; right: -8px; height: 8px; margin-top: -4px; }

.miernik-poz {
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(max(10px, env(safe-area-inset-bottom)) + 120px);
  width: min(460px, calc(100vw - 24px));
}
.miernik-poz .miernik-pasek {
  height: 28px;
  margin-top: 6px;
  background: linear-gradient(to right, #d9dde6 0%, #7fb6ea 40%, #3b6fd0 75%, #5a2bb0 100%);
}
.miernik-poz.lewy .miernik-pasek {
  background: linear-gradient(to left, #d9dde6 0%, #7fb6ea 40%, #3b6fd0 75%, #5a2bb0 100%);
}
.miernik-poz .miernik-wskaznik { top: -8px; bottom: -8px; width: 8px; margin-left: -4px; }

/* ---------- Komunikat ---------- */
.komunikat {
  position: fixed;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  font-family: var(--font-baner);
  font-size: clamp(42px, 12vw, 110px);
  color: #fff;
  text-shadow: 0 0 18px rgba(59, 143, 224, .9), 0 4px 0 #0b0c10;
  pointer-events: none;
  white-space: nowrap;
  animation: wyskok .45s ease-out;
}
@keyframes wyskok {
  from { transform: translate(-50%, -50%) scale(.4); opacity: 0; }
  to   { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* ---------- Ekrany (start / koniec) ---------- */
.ekran {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background:
    linear-gradient(rgba(14, 16, 26, .82), rgba(14, 16, 26, .92)),
    url('assets/lane-reference.jpg') center / cover no-repeat;
  -webkit-user-select: text;
  user-select: text;
}
.karta {
  width: min(760px, 100%);
  margin: auto 0;
  background: rgba(22, 25, 37, .92);
  border: 1px solid #3a4160;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
}
.logo {
  font-family: var(--font-baner);
  font-weight: 400;
  font-size: clamp(34px, 9vw, 58px);
  letter-spacing: 6px;
  text-align: center;
  margin: 0 0 12px;
}
.logo span { color: #ffd76a; }
#ekranStart .logo { margin-bottom: 0; }
.podtytul { text-align: center; color: #ffd76a; margin: 0 0 14px; letter-spacing: 3px; font-weight: 700; font-size: 14px; }

.koszulki { display: flex; gap: 8px; flex-wrap: wrap; }
.koszulka {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: #0f1220; color: #fff; font: inherit; font-size: 13px;
  border: 2px solid #3a4160; border-radius: 8px; padding: 4px 6px; cursor: pointer;
}
.koszulka canvas { width: 48px; height: 48px; }
.koszulka[aria-pressed="true"] { border-color: #ffd76a; background: #23273a; }

.start-uklad { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.start-podglad { text-align: center; }
.start-podglad canvas {
  width: 176px; height: 240px;
  background: linear-gradient(#2a2f45, #1b1f2e);
  border-radius: 10px;
  border: 1px solid #3a4160;
}
.start-podglad small { display: block; color: var(--szary); margin-top: 4px; }
.start-form { flex: 1 1 280px; display: flex; flex-direction: column; gap: 10px; }

fieldset {
  border: 1px solid #3a4160;
  border-radius: 8px;
  margin: 0;
  padding: 6px 10px 10px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
legend { color: #ffd76a; font-weight: 700; padding: 0 4px; }
.opcja { display: flex; align-items: center; gap: 6px; font-size: 17px; cursor: pointer; }
.opcja input { width: 20px; height: 20px; accent-color: var(--akcent); }

.pole { display: flex; flex-direction: column; gap: 4px; font-weight: 700; color: #ffd76a; }
.pole input {
  font: inherit;
  font-weight: 400;
  font-size: 18px;
  color: #fff;
  background: #0f1220;
  border: 1px solid #4a5170;
  border-radius: 8px;
  padding: 9px 10px;
}
.pole input:focus { outline: 2px solid var(--akcent); }

.kolory { display: flex; gap: 10px; flex-wrap: wrap; }
.kolor {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  box-shadow: inset -6px -6px 10px rgba(0, 0, 0, .45), inset 4px 4px 8px rgba(255, 255, 255, .35);
  padding: 0;
}
.kolor[aria-pressed="true"] { border-color: #fff; transform: scale(1.12); }

.blad { color: #ff7b7b; min-height: 1.2em; margin: 0; }

.top10-box { margin-top: 16px; }
.top10-box h2 { font-family: var(--font-baner); font-weight: 400; margin: 0 0 6px; letter-spacing: 2px; }
.top10 { margin: 0; padding-left: 2em; columns: 2; column-gap: 28px; }
.top10 li { padding: 3px 0; break-inside: avoid; }
.top10 li .pkt { float: right; font-weight: 700; color: #ffd76a; }
.top10 li.moj { color: #7fe08f; }
.top10 li.info { list-style: none; margin-left: -2em; color: var(--szary); }
@media (max-width: 520px) { .top10 { columns: 1; } }

.wynik-koncowy { text-align: center; font-size: 22px; }
.wynik-koncowy strong { font-family: var(--font-baner); font-size: 46px; color: #ffd76a; display: block; }
.top-form { display: flex; flex-direction: column; gap: 10px; align-items: stretch; max-width: 360px; margin: 0 auto; }
.top-form p { margin: 0; text-align: center; color: #7fe08f; }
.info-top { text-align: center; color: var(--szary); min-height: 1.2em; }
#btnJeszczeRaz { display: block; margin: 18px auto 0; }
