/* ====== Mądrala — styl ====== */

:root {
  --bg-top: #f3efff;
  --bg-bottom: #e9f8f1;
  --ink: #2e3a4e;
  --ink-soft: #6b7a92;
  --card: #ffffff;
  --coral: #ff8a5c;
  --sun: #ffd449;
  --sky: #5bb8f5;
  --lilac: #b893f0;
  --mint: #4fd1a5;
  --rose: #f56b8d;
  --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));
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

/* ---- górny pasek ---- */
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 18px; }
.logo { font-weight: 800; font-size: 1.35rem; flex: 1; }
.stars { font-weight: 700; background: var(--card); padding: 6px 14px; border-radius: 999px; box-shadow: var(--shadow); }
.gear, .home-btn {
  font-size: 1.4rem;
  background: var(--card);
  border: none;
  border-radius: 50%;
  width: 46px; height: 46px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s;
}
.gear:hover { transform: rotate(30deg); }
.home-btn:hover { transform: scale(1.1); }

/* ---- ekrany ---- */
.screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 14px 18px 60px;
  text-align: center;
  max-width: 820px;
  margin: 0 auto;
}
.hidden { display: none !important; }

.welcome { font-size: clamp(1.6rem, 5vw, 2.2rem); margin: 6px 0 0; }
.mode-title { font-size: clamp(1.4rem, 4.5vw, 1.9rem); margin: 6px 0 0; }
.progress-line { margin: 0; color: var(--ink-soft); font-weight: 700; }

.surprise-btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 1.3rem;
  color: #fff;
  background: var(--lilac);
  border: none;
  border-radius: 999px;
  padding: 14px 34px;
  cursor: pointer;
  box-shadow: 0 8px 0 #8f6ac4;
  transition: transform 0.12s, box-shadow 0.12s;
}
.surprise-btn:active { transform: translateY(5px); box-shadow: 0 3px 0 #8f6ac4; }

/* ---- kategorie ---- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  width: 100%;
}
.cat-card {
  font-family: inherit;
  background: var(--card);
  color: var(--ink);
  border: none;
  border-radius: 22px;
  padding: 20px 12px;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  transition: transform 0.12s;
}
.cat-card:hover { transform: translateY(-3px); }
.cat-card .ci { font-size: 2.4rem; }
.cat-card .cn { font-weight: 800; font-size: 1.2rem; }
.cat-card .cc { color: var(--ink-soft); font-size: 0.95rem; }

/* ---- lista artykułów ---- */
.article-list { display: flex; flex-direction: column; gap: 14px; width: 100%; }
.article-item {
  font-family: inherit;
  background: var(--card);
  color: var(--ink);
  border: none;
  border-radius: 20px;
  padding: 16px 20px;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 1.2rem;
  font-weight: 700;
  transition: transform 0.1s;
  text-align: left;
}
.article-item:hover { transform: translateY(-2px); }
.article-item .ai { font-size: 1.8rem; }
.article-item .read-badge { margin-left: auto; color: #1f9d6f; font-size: 1.3rem; }

/* ---- artykuł ---- */
.paper {
  background: var(--card);
  border-radius: 26px;
  padding: 26px clamp(18px, 5vw, 40px) 30px;
  box-shadow: var(--shadow);
  width: 100%;
  text-align: left;
}
.article-title {
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  margin: 0 0 10px;
  text-align: center;
}
.section-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0 0 16px;
}
.section-row p {
  font-family: "Andika", sans-serif;
  font-size: 1.15rem;
  line-height: 1.65;
  margin: 0;
  flex: 1;
}
.say-btn {
  font-size: 1.1rem;
  background: #eef3fa;
  border: none;
  border-radius: 12px;
  width: 42px; height: 42px;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.1s, background 0.15s;
}
.say-btn:hover { background: #dcE9f7; transform: scale(1.08); }
.say-btn.speaking { background: var(--sun); }

.diagram { margin: 8px auto 20px; max-width: 560px; }
.diagram svg { width: 100%; height: auto; display: block; }

.fact-box {
  background: #fff6d6;
  border: 3px dashed var(--sun);
  border-radius: 18px;
  padding: 14px 18px;
  margin: 10px 0 6px;
}
.fact-label { font-weight: 800; font-size: 1.05rem; }
.fact-box p {
  font-family: "Andika", sans-serif;
  font-size: 1.1rem;
  line-height: 1.6;
  margin: 6px 0 0;
}

/* ---- quiz w artykule ---- */
.quiz-section h3 { font-size: 1.4rem; margin: 22px 0 12px; text-align: center; }
.quiz-q { font-weight: 800; font-size: 1.15rem; margin: 14px 0 8px; font-family: "Andika", sans-serif; }
.quiz-opts { display: flex; flex-direction: column; gap: 8px; }
.quiz-opt {
  font-family: "Andika", sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  background: #f1f5fb;
  border: 3px solid transparent;
  border-radius: 14px;
  padding: 10px 16px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.1s, border-color 0.1s, background 0.15s;
}
.quiz-opt:hover { transform: translateY(-1px); }
.quiz-opt.correct { background: #dff7ec; border-color: var(--mint); }
.quiz-opt.wrong { background: #ffe9e4; border-color: var(--rose); animation: shake 0.35s; }
.quiz-opt:disabled { cursor: default; }
.quiz-done {
  text-align: center;
  font-weight: 800;
  font-size: 1.2rem;
  color: #1f9d6f;
  margin: 16px 0 0;
}

@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ---- przyciski ---- */
.row { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.pill-btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  background: var(--sky);
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  cursor: pointer;
  box-shadow: 0 5px 0 #3d92cc;
  transition: transform 0.1s, box-shadow 0.1s;
}
.pill-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #3d92cc; }
.pill-btn.ghost { background: var(--card); color: var(--ink); box-shadow: 0 5px 0 rgba(46,58,78,0.18); }

.next-btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 1.25rem;
  color: #fff;
  background: var(--coral);
  border: none;
  border-radius: 999px;
  padding: 14px 32px;
  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; }

/* ---- fiszki ---- */
.deck-heading { margin-top: 18px; }
.mode-hint { color: var(--ink-soft); margin: 0; font-size: 0.95rem; }

.fcard {
  background: var(--card);
  border-radius: 28px;
  box-shadow: 0 10px 0 rgba(46,58,78,0.18);
  width: min(92vw, 460px);
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  padding: 24px;
  transition: transform 0.12s;
  user-select: none;
}
.fcard:active { transform: scale(0.98); }

.fcard-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.fcard-content .f-emoji { font-size: clamp(5rem, 22vw, 8rem); line-height: 1; }
.fcard-content .f-text {
  font-family: "Andika", sans-serif;
  font-weight: 700;
  font-size: clamp(1.8rem, 7vw, 2.8rem);
}
.fcard-content .f-back {
  font-family: "Andika", sans-serif;
  font-weight: 700;
  font-size: clamp(1.7rem, 6.5vw, 2.6rem);
  color: #1f9d6f;
}
.fcard-content svg { max-width: 220px; height: auto; }
.fcard-content .f-swatch {
  width: 190px; height: 150px;
  border-radius: 22px;
  box-shadow: inset 0 0 0 4px rgba(46,58,78,0.15);
}
.fcard-hint { margin: 0; color: var(--ink-soft); font-size: 0.9rem; }

.deck-counter { margin: 0; font-weight: 800; color: var(--ink-soft); }
.flip-btn { background: var(--lilac); box-shadow: 0 5px 0 #8f6ac4; }
.flip-btn:active { box-shadow: 0 2px 0 #8f6ac4; }

/* ---- 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, 400px);
  text-align: center;
}
.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: 20px;
  text-align: left;
}
.setting-label { font-weight: 700; font-size: 1.05rem; }
#rate { width: 130px; accent-color: var(--coral); }
#resetProgress { margin-bottom: 16px; }
.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ść ---- */
button:focus-visible { outline: 4px solid var(--ink); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
