* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Andika", "Nunito", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #fff8e1; color: #333;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
#ekran { height: 100%; overflow-y: auto; padding-bottom: 24px; }
button { font: inherit; color: inherit; border: none; cursor: pointer; }

/* --- powitanie --- */
#powitanie { position: fixed; inset: 0; background: linear-gradient(135deg, #ffd54f, #ff8a65); display: flex; align-items: center; justify-content: center; z-index: 10; }
.powitanie-srodek { text-align: center; color: #fff; }
.powitanie-emoji { font-size: 56px; }
#powitanie h1 { font-size: 56px; margin: 12px 0 32px; text-shadow: 0 3px 0 rgba(0,0,0,.15); }
#przycisk-start { font-size: 44px; font-weight: bold; padding: 22px 70px; border-radius: 60px; background: #fff; color: #ff7043; box-shadow: 0 8px 0 rgba(0,0,0,.15); animation: puls 1.6s infinite; }

/* --- start --- */
.naglowek { display: flex; align-items: center; gap: 16px; padding: 16px 24px 4px; }
.logo { font-size: 34px; font-weight: bold; flex: 1; }
.licznik-gwiazdek { font-size: 24px; font-weight: bold; background: rgba(255,255,255,.85); color: #333; padding: 6px 16px; border-radius: 30px; }
.licznik-gwiazdek.duzy { font-size: 30px; background: #fff; box-shadow: 0 3px 0 rgba(0,0,0,.08); }
.trybik { font-size: 30px; background: transparent; opacity: .5; padding: 8px; border-radius: 50%; transition: transform 2s linear, opacity .3s; }
.trybik.trzymam { transform: rotate(360deg); opacity: 1; }
.sekcja { margin: 18px 24px 8px; font-size: 26px; color: #6d4c41; }
.start-glowne, .kafle { display: grid; gap: 16px; padding: 8px 24px; }
.start-glowne { grid-template-columns: repeat(4, 1fr); }
.kafle { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.kafel {
  min-height: 150px; border-radius: 26px; color: #fff; font-size: 24px; padding: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  box-shadow: 0 7px 0 rgba(0,0,0,.18); transition: transform .1s;
  text-shadow: 0 2px 2px rgba(0,0,0,.25);
}
.kafel:active { transform: translateY(5px); box-shadow: 0 2px 0 rgba(0,0,0,.18); }
.kafel .emoji { font-size: 58px; line-height: 1; text-shadow: none; }
.kafel.specjalny { min-height: 130px; font-size: 21px; }
.kafel-obraz { width: 100px; height: 80px; background: rgba(255,255,255,.9); border-radius: 18px; display: flex; align-items: center; justify-content: center; text-shadow: none; }
.kafel-obraz .emoji { font-size: 54px; }
.kafel-obraz .liczba { color: #ff9800; font-size: 40px; font-weight: bold; }
.kafel-obraz .rys { width: 90px; height: 72px; }
.kafle.gry { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); padding-top: 24px; }
.kafle.gry .kafel { min-height: 190px; font-size: 26px; }

.podglad-slow { display: flex; flex-wrap: wrap; gap: 10px; padding: 20px 24px; justify-content: center; }
.mini { background: #fff; border-radius: 16px; padding: 8px; width: 110px; display: flex; flex-direction: column; align-items: center; box-shadow: 0 3px 0 rgba(0,0,0,.08); font-size: 17px; }
.mini .emoji { font-size: 44px; }
.mini .rys { width: 90px; height: 64px; }
.mini .liczba { font-size: 38px; font-weight: bold; color: #ff9800; }

/* --- pasek --- */
.pasek { display: flex; align-items: center; gap: 12px; padding: 10px 16px; color: #fff; position: sticky; top: 0; z-index: 2; }
.pasek .dom { font-size: 30px; width: 64px; height: 64px; border-radius: 50%; background: rgba(255,255,255,.3); }
.pasek .tytul { flex: 1; font-size: 28px; font-weight: bold; text-shadow: 0 2px 2px rgba(0,0,0,.2); }
.postep-rundy { height: 10px; background: #eee; }
.postep-rundy div { height: 100%; transition: width .4s; }

/* --- pytanie --- */
.pytanie { display: flex; flex-direction: column; align-items: center; padding: 12px 16px; gap: 12px; }
.polecenie { font-size: 22px; color: #6d4c41; text-align: center; padding: 8px 16px; }
.pokaz { display: flex; align-items: center; justify-content: center; gap: 16px; min-height: 90px; }
.glosnik { font-size: 40px; width: 84px; height: 84px; border-radius: 50%; background: #fff; box-shadow: 0 5px 0 rgba(0,0,0,.12); }
.glosnik.duzy { font-size: 60px; width: 120px; height: 120px; animation: puls 2s infinite; }
.slowo-do-czytania { font-size: 72px; font-weight: bold; background: #fff; padding: 6px 48px; border-radius: 24px; box-shadow: 0 5px 0 rgba(0,0,0,.08); letter-spacing: 2px; }
.scena-duza { width: 300px; height: 240px; background: #fff; border-radius: 24px; padding: 10px; box-shadow: 0 5px 0 rgba(0,0,0,.08); }
.scena-duza .rys { width: 100%; height: 100%; }

.opcje { display: grid; gap: 22px; width: 100%; max-width: 1100px; justify-content: center; }
.opcje.n2 { grid-template-columns: repeat(2, minmax(200px, 380px)); }
.opcje.n3 { grid-template-columns: repeat(3, minmax(180px, 320px)); }
.opcje.n4 { grid-template-columns: repeat(4, minmax(160px, 260px)); }
.opcja {
  background: #fff; border-radius: 28px; aspect-ratio: 4 / 3; padding: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 0 7px 0 rgba(0,0,0,.12); border: 5px solid transparent; transition: transform .12s, opacity .3s;
}
.opcja:active { transform: scale(.97); }
.opcja .emoji { font-size: 110px; line-height: 1; }
.opcja .liczba { font-size: 110px; font-weight: bold; color: #ff9800; }
.opcja .rys { width: 100%; height: 100%; }
.opcje.przyimki .opcja { aspect-ratio: auto; padding: 8px 8px 12px; }
.opcje.przyimki .opcja .rys { height: 110px; }
.opcje.przyimki .opcja b { font-size: 40px; }
.opcja.dobrze { border-color: #43a047; background: #e8f5e9; animation: podskok .5s; }
.opcja.zle { opacity: .35; animation: trzes .4s; }
.opcja.podpowiedz { animation: puls 1s infinite; border-color: #ffb300; }
.opcja.wybrana { border-color: #64b5f6; background: #e3f2fd; }

/* --- fiszki --- */
.fiszka { display: flex; align-items: center; justify-content: center; gap: 20px; padding: 20px; }
.strzalka { font-size: 50px; width: 100px; height: 100px; border-radius: 50%; background: #fff; box-shadow: 0 6px 0 rgba(0,0,0,.12); color: #6d4c41; }
.karta { background: #fff; border-radius: 32px; width: min(560px, 60vw); min-height: 380px; padding: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 8px 0 rgba(0,0,0,.1); cursor: pointer; }
.karta.wjazd { animation: wjazd .35s; }
.karta-obraz { height: 220px; width: 100%; display: flex; align-items: center; justify-content: center; }
.karta-obraz .emoji { font-size: 170px; line-height: 1; }
.karta-obraz .liczba { font-size: 170px; font-weight: bold; color: #ff9800; }
.karta-obraz .rys { height: 100%; width: 100%; }
.karta-en { font-size: 60px; font-weight: bold; text-align: center; }
.karta-pl { font-size: 26px; color: #999; }
.karta-zdanie { font-size: 26px; color: #6d4c41; margin-top: 6px; }
.licznik { text-align: center; font-size: 20px; color: #999; }

/* --- wspólne przyciski --- */
.przyciski { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; padding: 12px; }
.duzy-przycisk { font-size: 26px; font-weight: bold; padding: 18px 32px; border-radius: 40px; background: #78909c; color: #fff; box-shadow: 0 6px 0 rgba(0,0,0,.18); }
.duzy-przycisk:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,.18); }
.duzy-przycisk.ostrzezenie { background: #e53935; font-size: 20px; }

/* --- koniec rundy --- */
.koniec { text-align: center; padding: 20px; }
.koniec h1 { font-size: 46px; margin: 10px 0; }
.gwiazdki-wynik { font-size: 52px; letter-spacing: 4px; }
.gwiazdki-wynik .szare { color: #ccc; }
.wynik-testu { font-size: 54px; }
.wynik-testu b { color: #e53935; font-size: 80px; }
.nowa-naklejka { font-size: 30px; margin: 16px; }
.nowa-naklejka span { font-size: 70px; display: inline-block; animation: podskok 1s infinite; }
.do-powtorki { margin: 10px auto; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 900px; }
.do-powtorki p { width: 100%; font-size: 22px; margin: 4px; color: #6d4c41; }

/* --- memory --- */
.memory { display: grid; gap: 14px; padding: 10px 24px; grid-template-columns: repeat(4, 1fr); max-width: 1000px; margin: 0 auto; }
.memory.n12, .memory.n10 { grid-template-columns: repeat(4, 1fr); }
.mkarta { aspect-ratio: 4 / 3; border-radius: 20px; position: relative; background: transparent; perspective: 600px; padding: 0; }
.mkarta .tyl, .mkarta .przod { position: absolute; inset: 0; border-radius: 20px; display: flex; align-items: center; justify-content: center; backface-visibility: hidden; transition: transform .4s; box-shadow: 0 5px 0 rgba(0,0,0,.12); }
.mkarta .tyl { background: #7e57c2; color: #fff; font-size: 54px; font-weight: bold; }
.mkarta .przod { background: #fff; transform: rotateY(180deg); padding: 8px; }
.mkarta.odkryta .tyl { transform: rotateY(180deg); }
.mkarta.odkryta .przod { transform: rotateY(0); }
.mkarta.para .przod { background: #e8f5e9; outline: 4px solid #43a047; }
.mkarta .emoji { font-size: 64px; }
.mkarta .liczba { font-size: 64px; font-weight: bold; color: #ff9800; }
.mkarta .rys { width: 100%; height: 100%; }
.mslowo { font-size: 32px; font-weight: bold; }

/* --- naklejki --- */
.info { text-align: center; font-size: 20px; color: #6d4c41; padding: 0 20px; }
.album { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 12px; padding: 16px 24px; }
.nak { aspect-ratio: 1; background: #fff; border-radius: 20px; display: flex; align-items: center; justify-content: center; font-size: 54px; box-shadow: 0 4px 0 rgba(0,0,0,.08); }
.nak:not(.ma) { opacity: .3; font-size: 32px; }
.nak.skok { animation: podskok .6s; }

/* --- panel rodzica --- */
.zagadka { text-align: center; font-size: 34px; padding-top: 40px; }
.panel { padding: 10px 24px; display: grid; gap: 16px; max-width: 1100px; margin: 0 auto; user-select: text; }
.panel section { background: #fff; border-radius: 18px; padding: 12px 20px; font-size: 18px; }
.panel h3 { margin: 4px 0 10px; color: #546e7a; }
.panel table { border-collapse: collapse; width: 100%; font-size: 16px; }
.panel th, .panel td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #eee; }
.panel label { display: block; margin: 8px 0; font-size: 18px; }
.panel input[type=checkbox] { width: 24px; height: 24px; vertical-align: middle; }
.panel .info { text-align: left; font-size: 16px; padding: 0; }
.przelaczniki { columns: 2; }

/* --- efekty --- */
.konfetti { position: fixed; font-size: 30px; pointer-events: none; z-index: 20; animation: leci 1.1s ease-out forwards; }
@keyframes leci { to { transform: translate(var(--dx), var(--dy)) rotate(200deg); opacity: 0; } }
@keyframes puls { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes podskok { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-16px) scale(1.04); } }
@keyframes trzes { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }
@keyframes wjazd { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* --- mniejsze ekrany / pionowo --- */
@media (max-width: 900px) {
  .start-glowne { grid-template-columns: repeat(2, 1fr); }
  .opcje.n3, .opcje.n4 { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
  .opcje.n2 { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
  .opcja .emoji, .opcja .liczba { font-size: 80px; }
  .memory { grid-template-columns: repeat(3, 1fr); }
  .karta { width: 70vw; }
  .slowo-do-czytania { font-size: 54px; }
}
@media (max-height: 700px) and (orientation: landscape) {
  .opcja { aspect-ratio: 5 / 3; }
  .opcja .emoji, .opcja .liczba { font-size: 84px; }
  .karta { min-height: 300px; }
  .karta-obraz { height: 160px; }
  .karta-obraz .emoji { font-size: 130px; }
  .glosnik.duzy { width: 100px; height: 100px; font-size: 50px; }
}
