/* GRUNT — design system: ciemny granat, miękkie przejścia, zero czerwieni */

:root {
  --tlo: #0E1420;
  --powierzchnia: #18202E;
  --tekst: #D8DEE9;
  --akcent: #5B8FB9;
  --akcent-glow: rgba(91, 143, 185, .35);
  --sukces: #7FB69E;
  --sukces-glow: rgba(127, 182, 158, .35);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overscroll-behavior: none;
}

body {
  background: var(--tlo);
  color: var(--tekst);
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100dvh;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

/* ---------- Ekrany: jedna sekcja naraz, łagodny crossfade ---------- */

.ekran {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: calc(env(safe-area-inset-top, 0px) + 24px) 24px
           calc(env(safe-area-inset-bottom, 0px) + 72px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .32s ease, visibility .32s;
  height: 100dvh;
}

.ekran.aktywny {
  opacity: 1;
  visibility: visible;
}

/* ---------- Typografia ---------- */

.instrukcja {
  font-size: 32px;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
  max-width: 420px;
}

/* instrukcja u góry ekranu nie może wjeżdżać pod przycisk głośnika */
#ekran-uziemienie, #ekran-zadanie {
  padding-top: calc(env(safe-area-inset-top, 0px) + 88px);
}

.komunikat {
  font-size: 22px;
  text-align: center;
  line-height: 1.4;
  max-width: 420px;
  min-height: 1.4em;
  opacity: .92;
  transition: opacity .4s ease;
}

.komunikat.przezroczysty { opacity: 0; }

.naglowek {
  font-size: 38px;
  font-weight: 700;
  text-align: center;
}

.naglowek-maly {
  font-size: 28px;
  font-weight: 600;
  text-align: center;
}

.notka {
  font-size: 17px;
  text-align: center;
  line-height: 1.45;
  opacity: .65;
  max-width: 380px;
}

/* ---------- Przyciski ---------- */

.btn-glowny {
  width: 100%;
  max-width: 420px;
  min-height: 88px;
  border: none;
  border-radius: 20px;
  background: var(--akcent);
  color: #0E1420;
  font-size: 24px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform .26s ease, box-shadow .26s ease;
  box-shadow: 0 0 24px var(--akcent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn-glowny:active {
  transform: scale(.97);
}

.checkin-przyciski {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  max-width: 420px;
}

.btn-checkin { min-height: 96px; }

.btn-telefon {
  background: var(--sukces);
  box-shadow: 0 0 24px var(--sukces-glow);
}

.btn-dyskretny {
  background: none;
  border: none;
  color: var(--tekst);
  opacity: .55;
  font-size: 18px;
  font-family: inherit;
  padding: 16px 32px;
  cursor: pointer;
}

.btn-przerwij {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: none;
  border: none;
  color: var(--tekst);
  opacity: .38;
  font-size: 16px;
  font-family: inherit;
  padding: 14px 28px;
  cursor: pointer;
  display: none;
  z-index: 40;
  transition: opacity .4s ease;
}

.btn-przerwij.widoczny { display: block; }

.btn-glos {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  right: 14px;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: var(--powierzchnia);
  color: var(--tekst);
  opacity: .55;
  cursor: pointer;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .4s ease;
}

.btn-glos.wlaczony { opacity: .95; color: var(--akcent); }

/* ---------- Pacer oddechowy ---------- */

.pacer-obszar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(72vw, 340px);
  height: min(72vw, 340px);
}

.pacer-kolo {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #6B9DC6, var(--akcent) 68%);
  box-shadow: 0 0 60px var(--akcent-glow), 0 0 120px var(--akcent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(.55);
  will-change: transform;
}

.pacer-kolo span {
  font-size: 30px;
  font-weight: 600;
  color: #0E1420;
  letter-spacing: .04em;
}

.pasek-postepu {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 52px);
  left: 24px;
  right: 24px;
  height: 4px;
  border-radius: 2px;
  background: var(--powierzchnia);
  overflow: hidden;
}

.pasek-wypelnienie {
  height: 100%;
  width: 0%;
  background: var(--akcent);
  border-radius: 2px;
}

/* ---------- Uziemienie ---------- */

.uziem-obszar {
  position: relative;
  width: 100%;
  max-width: 460px;
  flex: 1 1 auto;
  min-height: 0;
}

.uziem-kolko {
  position: absolute;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--akcent);
  box-shadow: 0 0 28px var(--akcent-glow);
  opacity: 0;
  transform: scale(.6);
  transition: opacity .3s ease, transform .3s ease, box-shadow .3s ease;
  touch-action: none;
}

.uziem-kolko.widoczne { opacity: 1; transform: scale(1); }

.uziem-kolko.zielone {
  background: var(--sukces);
  box-shadow: 0 0 28px var(--sukces-glow);
}

.uziem-kolko.trafione {
  background: var(--sukces);
  box-shadow: 0 0 44px var(--sukces-glow), 0 0 80px var(--sukces-glow);
  transform: scale(1.12);
}

.uziem-domek {
  position: absolute;
  width: 128px;
  height: 128px;
  border-radius: 26px;
  border: 3px dashed var(--akcent);
  opacity: .8;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow .45s ease, border-color .45s ease;
}

.uziem-domek.przyjal {
  border-color: var(--sukces);
  border-style: solid;
  box-shadow: 0 0 40px var(--sukces-glow);
}

/* ---------- Zadania sensomotoryczne ---------- */

.zadanie-obszar {
  position: relative;
  width: 100%;
  max-width: 460px;
  flex: 1 1 auto;
  min-height: 0;
  touch-action: none;
}

.zadanie-obszar svg {
  width: 100%;
  height: 100%;
  display: block;
}

.banka {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, rgba(216,222,233,.35), var(--akcent-glow) 60%, rgba(91,143,185,.15));
  border: 2px solid rgba(91,143,185,.5);
  transition: transform .3s ease, opacity .3s ease;
  touch-action: none;
}

.banka.pekla {
  transform: scale(1.35);
  opacity: 0;
}

.kafel {
  position: absolute;
  width: 100px;
  height: 100px;
  border-radius: 22px;
  box-shadow: 0 0 24px var(--akcent-glow);
  touch-action: none;
  transition: box-shadow .4s ease;
}

.kafel.wraca { transition: left .5s ease, top .5s ease; }

.strefa {
  position: absolute;
  bottom: 0;
  width: 42%;
  height: 120px;
  border-radius: 24px;
  border: 3px dashed;
  opacity: .75;
  transition: box-shadow .45s ease, opacity .45s ease;
}

.strefa.niebieska { left: 2%; border-color: var(--akcent); }
.strefa.zielona  { right: 2%; border-color: var(--sukces); }
.strefa.przyjela { opacity: 1; }

/* ---------- Gra: jedna mechanika, cztery klimaty ---------- */

#ekran-gra {
  padding-top: calc(env(safe-area-inset-top, 0px) + 88px);
  --gra-akcent: var(--sukces);
  --gra-glow: var(--sukces-glow);
}

/* klimaty „wodne" i „nocne" grają niebieskim akcentem */
#ekran-gra.skin-gwiazdy,
#ekran-gra.skin-krople {
  --gra-akcent: var(--akcent);
  --gra-glow: var(--akcent-glow);
}

/* Obiekty wlatujące i wylatujące (liście) nie mogą nachodzić na instrukcję ani
   na tekst pod planszą — maska wygasza je miękko przy górnej i dolnej krawędzi
   (twarde overflow: hidden ucinało liść w połowie). */
#graObszar {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 18px, #000 calc(100% - 34px), transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 18px, #000 calc(100% - 34px), transparent 100%);
}

.gra-obiekt {
  position: absolute;
  opacity: 0;
  transition: opacity .34s ease, transform .26s ease;
  touch-action: none;
  will-change: left, top;
}

.gra-obiekt.widoczny { opacity: .95; }

.gra-obiekt.zlapany {
  transform: scale(1.6);
  opacity: 0;
}

.gra-wnetrze {
  display: block;
  width: 100%;
  height: 100%;
}

/* świetliki — miękka zielona poświata */
.skin-swietliki .gra-wnetrze {
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, rgba(216,230,222,.9), #7FB69E 42%, rgba(127,182,158,.15) 72%, transparent 78%);
  filter: drop-shadow(0 0 18px rgba(127, 182, 158, .55));
}

/* liście — kształt liścia, spadają i kołyszą się */
.skin-liscie .gra-wnetrze {
  border-radius: 4px 62% 4px 62%;
  background: linear-gradient(140deg, #9AC3AD, #5C8B78);
  box-shadow: 0 0 22px rgba(127, 182, 158, .28);
}

/* gwiazdy — jasny punkt, prawie nieruchomy, delikatnie mruga */
.skin-gwiazdy .gra-wnetrze {
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #E6EEF6 0%, #9CC0DA 28%, rgba(91,143,185,.28) 60%, transparent 72%);
  filter: drop-shadow(0 0 20px rgba(91, 143, 185, .65));
}

/* krople — pierścień rozchodzący się jak na wodzie;
   wnętrze lekko wypełnione, żeby całe kółko czytało się jako cel */
.skin-krople .gra-wnetrze {
  border-radius: 50%;
  border: 4px solid rgba(129, 176, 211, .92);
  background: radial-gradient(circle at 50% 45%, rgba(91,143,185,.28), rgba(91,143,185,.1) 70%, transparent);
  box-shadow: 0 0 26px rgba(91, 143, 185, .4), inset 0 0 22px rgba(91, 143, 185, .2);
}

.gra-postep {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 320px;
}

.gra-kropka {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--powierzchnia);
  transition: background .5s ease, box-shadow .5s ease;
}

.gra-kropka.zapalona {
  background: var(--gra-akcent);
  box-shadow: 0 0 10px var(--gra-glow);
}

/* ---------- Spokój / logo ---------- */

.spokoj-logo { opacity: .9; }

/* ---------- Statystyki ---------- */

.staty-lista {
  width: 100%;
  max-width: 420px;
  max-height: 46dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.staty-wpis {
  background: var(--powierzchnia);
  border-radius: 14px;
  padding: 16px 20px;
  font-size: 18px;
  line-height: 1.5;
}

.staty-wpis small { opacity: .6; font-size: 15px; }

/* ---------- Reduced motion: ozdobniki off, pacer zostaje ---------- */

@media (prefers-reduced-motion: reduce) {
  .banka, .uziem-kolko, .kafel { transition-duration: .01s; }
  /* pacer jest funkcjonalny — celowo nie wyłączany */
}
