/* ====== Czytanka — styl ====== */

:root {
  --bg-top: #e9f8f1;
  --bg-bottom: #e3f0ff;
  --ink: #2e3a4e;
  --ink-soft: #6b7a92;
  --card: #ffffff;
  --coral: #ff8a5c;
  --sun: #ffd449;
  --sky: #5bb8f5;
  --lilac: #b893f0;
  --mint: #4fd1a5;
  --shadow: 0 6px 0 rgba(46, 58, 78, 0.15);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Baloo 2", "Comic Sans MS", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

/* ---- górny pasek ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
}

.logo {
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: 0.5px;
}

.stars {
  font-weight: 700;
  font-size: 1.2rem;
  background: var(--card);
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.gear {
  font-size: 1.5rem;
  background: var(--card);
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s;
}
.gear:hover { transform: rotate(30deg); }

/* ---- scena ---- */
.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 34px;
  padding: 20px;
  text-align: center;
}

/* ---- klocki z sylabami ---- */
.syllables {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}

.syllable {
  font-family: "Andika", "Baloo 2", sans-serif;
  font-weight: 700;
  font-size: clamp(2.4rem, 9vw, 4.2rem);
  line-height: 1;
  padding: 22px 26px;
  border: none;
  border-radius: 22px;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 0 rgba(46, 58, 78, 0.22);
  transition: transform 0.12s;
  user-select: none;
}

/* każdy klocek lekko przekrzywiony jak drewniane klocki */
.syllable:nth-child(odd)  { transform: rotate(-2.5deg); }
.syllable:nth-child(even) { transform: rotate(2deg); }

.syllable:active,
.syllable.speaking {
  transform: scale(1.12) rotate(0deg) !important;
  box-shadow: 0 3px 0 rgba(46, 58, 78, 0.22);
}

.syllable.c0 { background: var(--coral); }
.syllable.c1 { background: var(--sky); }
.syllable.c2 { background: var(--mint); }
.syllable.c3 { background: var(--lilac); }
.syllable.c4 { background: var(--sun); color: var(--ink); }

/* ---- całe słowo ---- */
.whole-word {
  font-family: "Andika", "Baloo 2", sans-serif;
  font-weight: 700;
  font-size: clamp(2rem, 7vw, 3.4rem);
  color: var(--ink);
  background: var(--card);
  border: 4px dashed var(--sky);
  border-radius: 999px;
  padding: 16px 44px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.12s;
  user-select: none;
}

.whole-word:active,
.whole-word.speaking {
  transform: scale(1.06);
  border-style: solid;
}

/* ---- podpowiedź ---- */
.hint {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

/* ---- przycisk następne ---- */
.next-btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 1.5rem;
  color: #fff;
  background: var(--coral);
  border: none;
  border-radius: 999px;
  padding: 16px 40px;
  cursor: pointer;
  box-shadow: 0 8px 0 #d96a3f;
  transition: transform 0.12s, box-shadow 0.12s;
}

.next-btn:active {
  transform: translateY(5px);
  box-shadow: 0 3px 0 #d96a3f;
}

.no-voice {
  color: #b3402f;
  background: #fff2ee;
  border-radius: 14px;
  padding: 12px 18px;
  font-size: 1rem;
}

/* ---- ustawienia ---- */
.settings {
  border: none;
  border-radius: 24px;
  padding: 28px 32px;
  box-shadow: 0 16px 40px rgba(46, 58, 78, 0.25);
  font-family: inherit;
  color: var(--ink);
  width: min(92vw, 380px);
}
.settings::backdrop { background: rgba(46, 58, 78, 0.4); }

.settings h2 {
  margin: 0 0 20px;
  font-size: 1.5rem;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.setting-label { font-weight: 700; font-size: 1.1rem; }

.case-switch {
  display: flex;
  background: #eef2f8;
  border-radius: 999px;
  padding: 4px;
}

.case-btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
}

.case-btn.active {
  background: var(--sky);
  color: #fff;
}

#rate { width: 140px; accent-color: var(--coral); }

.close-btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 1.15rem;
  width: 100%;
  color: #fff;
  background: var(--mint);
  border: none;
  border-radius: 999px;
  padding: 12px;
  cursor: pointer;
  box-shadow: 0 5px 0 #3aa981;
}
.close-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #3aa981; }

/* ---- dostępność / ruch ---- */
button:focus-visible {
  outline: 4px solid var(--ink);
  outline-offset: 3px;
}

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

@media (max-width: 480px) {
  .syllable { padding: 16px 18px; }
  .whole-word { padding: 12px 28px; }
}
