:root {
  --bg: #f7f8fc;
  --surface: #ffffff;
  --surface-soft: #eef4ff;
  --text: #1f2937;
  --muted: #5f6b7a;
  --border: #dbe2ea;
  --primary: #2457d6;
  --primary-dark: #173d9b;
  --accent: #c93030;
  --shadow: 0 12px 34px rgba(31, 41, 55, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
}

a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 999;
  background: #fff;
  padding: 10px 14px;
  border-radius: 10px;
}
.skip-link:focus { left: 8px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.header-inner,
main,
.footer-inner {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.header-inner {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.brand {
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  font-size: 1.08rem;
  letter-spacing: -.02em;
}

.site-nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
}

.site-nav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--primary); }

main { padding: 44px 0 64px; }

.hero {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 28px;
  align-items: stretch;
  margin-bottom: 30px;
}

.hero-copy,
.hero-card,
.tool-shell,
.content-card,
.notice,
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-copy { padding: clamp(26px, 5vw, 52px); }
.hero-copy h1 {
  margin: 0 0 16px;
  font-size: clamp(2rem, 5vw, 3.65rem);
  line-height: 1.06;
  letter-spacing: -.045em;
}
.hero-copy p {
  margin: 0 0 22px;
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 64ch;
}

.hero-card {
  padding: 28px;
  background: linear-gradient(145deg, #eef4ff, #fff);
}
.hero-card h2 { margin-top: 0; }
.hero-card ul { padding-left: 22px; }

.badge {
  display: inline-block;
  padding: 6px 11px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: #e9f0ff;
  color: var(--primary-dark);
  font-size: .88rem;
  font-weight: 750;
}

.button,
button,
select,
input[type="file"]::file-selector-button {
  font: inherit;
}

.button,
button {
  border: 0;
  border-radius: 11px;
  padding: 11px 16px;
  cursor: pointer;
  font-weight: 720;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.button-primary,
#loadTextButton {
  color: #fff;
  background: var(--primary);
}
.button-primary:hover,
#loadTextButton:hover { background: var(--primary-dark); color:#fff; }

.button-secondary,
#loadExampleButton,
#clearTextButton,
#prevButton,
#nextButton,
#speakSentenceButton {
  background: #edf1f6;
  color: var(--text);
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.section { margin-top: 34px; }
.section > h2 {
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  margin-bottom: 8px;
}
.section-intro {
  color: var(--muted);
  max-width: 78ch;
  margin-top: 0;
}

.tool-shell { overflow: hidden; }
.tool-header {
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
  background: #fbfcfe;
}
.tool-header h2 { margin: 0 0 5px; }
.tool-header p { margin: 0; color: var(--muted); }
.tool-body { padding: 24px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}

.field label {
  display: block;
  font-weight: 750;
  margin-bottom: 7px;
}

textarea,
select,
input[type="file"] {
  width: 100%;
}

textarea,
select {
  padding: 12px 13px;
  border: 1px solid #b8c3cf;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}

textarea {
  min-height: 150px;
  resize: vertical;
  font-family: inherit;
}

.hint {
  color: var(--muted);
  font-size: .92rem;
  margin: 7px 0 0;
}

.tool-actions { margin-top: 18px; }
.tool-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.reader-area {
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.reader-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.reader-toolbar p { margin: 0; color: var(--muted); }

#wordsContainer {
  min-height: 120px;
  margin-top: 20px;
  padding: 18px;
  border: 1px dashed #b7c3d0;
  border-radius: 14px;
  background: #fcfdff;
  overflow-x: auto;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 24px 8px;
}

.word-block {
  display: inline-block;
  margin: 14px 24px 22px 0;
  vertical-align: top;
}

.word-play button {
  height: 22px;
  border: none;
  background: #dce4ed;
  cursor: pointer;
  display: block;
  border-radius: 6px 6px 3px 3px;
  padding: 0;
}
.word-play button:hover { background: #c7d3df; }

.letters-row { white-space: nowrap; }
.letters-row button {
  font-size: 28px;
  margin-right: 6px;
  margin-bottom: 3px;
  padding: 8px 0;
  cursor: pointer;
  border: 2px solid #374151;
  border-radius: 8px;
  width: 50px;
  text-align: center;
  background: #fff;
}
.letters-row button:hover { background: #f3f6f9; }

.syl-row { white-space: nowrap; }
.syl-row button {
  height: 14px;
  margin-right: 6px;
  border: none;
  cursor: pointer;
  display: inline-block;
  border-radius: 5px;
  padding: 0;
}

.reader-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 16px;
}

#sentenceCounter {
  font-weight: 700;
  color: var(--muted);
}

.cards-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.content-card { padding: 24px; box-shadow: none; }
.content-card h3 { margin-top: 0; }
.content-card p:last-child { margin-bottom: 0; }

.notice {
  padding: 20px 22px;
  box-shadow: none;
  background: #fff9e9;
  border-color: #ead89f;
}
.notice strong { display: block; margin-bottom: 4px; }

.article {
  max-width: 860px;
  margin: 0 auto;
}
.article h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.12;
  letter-spacing: -.035em;
}
.article h2 { margin-top: 2.1em; }
.article h3 { margin-top: 1.5em; }
.article p, .article li { max-width: 78ch; }
.article .lead { font-size: 1.12rem; color: var(--muted); }

.faq-list { display: grid; gap: 12px; }
.faq-item { padding: 18px 20px; box-shadow: none; }
.faq-item h3 { margin: 0 0 6px; font-size: 1.05rem; }
.faq-item p { margin: 0; color: var(--muted); }

.site-footer {
  background: #172033;
  color: #dbe4f0;
  padding: 30px 0;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  flex-wrap: wrap;
}
.footer-inner p { margin: 0; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-links a { color: #e7efff; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 3px solid #7aa2ff;
  outline-offset: 3px;
}

@media (max-width: 850px) {
  .hero,
  .form-grid,
  .cards-3,
  .tool-options { grid-template-columns: 1fr; }
  .site-header { position: static; }
  .header-inner { align-items: flex-start; flex-direction: column; padding: 14px 0; }
  .site-nav { gap: 12px 16px; }
}

@media (max-width: 560px) {
  main { padding-top: 24px; }
  .header-inner, main, .footer-inner { width: min(100% - 20px, 1120px); }
  .hero-copy, .hero-card, .tool-body { padding: 20px; }
  .tool-header { padding: 18px 20px; }
  .letters-row button { width: 46px; font-size: 26px; }
}


/* NaukaCzytania 2.0 */
.brand { display:flex; align-items:center; gap:10px; }
.brand-mark { display:inline-grid; place-items:center; width:36px; height:36px; border-radius:11px; background:var(--primary); color:#fff; font-size:.88rem; font-weight:850; }
.eyebrow { color:var(--primary); text-transform:uppercase; letter-spacing:.08em; font-size:.76rem; font-weight:850; }
.section-heading { margin-bottom:18px; }
.section-heading h2 { margin:.25rem 0 .35rem; font-size:clamp(1.6rem,3vw,2.3rem); line-height:1.15; }
.section-heading p { margin:0; color:var(--muted); max-width:78ch; }
.cards-4 { display:grid; grid-template-columns:repeat(4,1fr); gap:16px; }
.learning-card { display:block; padding:22px; border:1px solid var(--border); border-radius:var(--radius); background:var(--surface); color:var(--text); text-decoration:none; box-shadow:0 6px 22px rgba(31,41,55,.05); transition:transform .15s ease, box-shadow .15s ease; }
.learning-card:hover { color:var(--text); transform:translateY(-2px); box-shadow:var(--shadow); }
.learning-card h3 { margin:12px 0 6px; font-size:1.22rem; }
.learning-card p { margin:0 0 12px; color:var(--muted); }
.lesson-icon { min-width:54px; height:54px; display:inline-grid; place-items:center; padding:0 8px; border-radius:14px; background:#e9f0ff; color:var(--primary-dark); font-weight:900; font-size:1.05rem; }
.card-link { font-weight:800; color:var(--primary); }
.center { text-align:center; }
.check-list li { margin:.35rem 0; }
.page-hero { max-width:850px; margin:0 auto 28px; text-align:center; }
.page-hero h1 { font-size:clamp(2rem,5vw,3.35rem); line-height:1.08; letter-spacing:-.04em; margin:.3rem 0 .7rem; }
.page-hero p { color:var(--muted); font-size:1.08rem; }
.page-hero.compact { padding:18px 0 8px; }
.wide-article { max-width:1040px; }
.learning-roadmap { display:grid; gap:12px; margin:26px 0 38px; }
.roadmap-step { display:flex; gap:18px; align-items:flex-start; text-decoration:none; color:var(--text); padding:20px; border:1px solid var(--border); border-radius:16px; background:#fff; }
.roadmap-step:hover { color:var(--text); border-color:#aabde8; }
.roadmap-step>span { flex:0 0 46px; height:46px; display:grid; place-items:center; border-radius:50%; background:var(--primary); color:#fff; font-weight:900; }
.roadmap-step h2 { margin:0 0 4px; font-size:1.25rem; }
.roadmap-step p { margin:0; color:var(--muted); }
.sound-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(64px,1fr)); gap:10px; margin:20px 0 34px; }
.sound-tile { min-height:64px; background:#fff; border:2px solid #d5deea; color:var(--text); font-size:1.45rem; }
.sound-tile.vowel { background:#fff3e8; border-color:#f0c69e; }
.example-box { padding:18px 20px; background:#eef4ff; border:1px solid #c8d8ff; border-radius:14px; margin:20px 0; }
.practice-list li { margin:.55rem 0; }
.syllable-board { display:grid; gap:12px; margin:20px 0 34px; }
.syllable-family { display:grid; grid-template-columns:70px repeat(6,1fr); gap:8px; align-items:center; }
.syllable-family>strong { color:var(--muted); text-align:center; }
.syllable-family button { background:#eef4ff; color:var(--primary-dark); }
.word-group { margin:30px 0; }
.word-chip-grid { display:flex; flex-wrap:wrap; gap:10px; }
.word-chip { background:#fff; border:1px solid var(--border); color:var(--text); font-size:1.08rem; min-width:92px; }
.sentence-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:12px; margin:20px 0 34px; }
.sentence-card { padding:18px; border:1px solid var(--border); border-radius:14px; background:#fff; }
.sentence-card p { font-size:1.18rem; margin:0 0 12px; }
.sentence-card button { background:#edf1f6; color:var(--text); }
.level-guide { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; margin:20px 0 28px; }
.level-guide>div { padding:16px; border-radius:14px; background:#fff; border:1px solid var(--border); }
.level-guide p { margin:8px 0 0; color:var(--muted); }
.level { display:inline-flex; align-items:center; padding:5px 9px; border-radius:999px; font-size:.8rem; font-weight:800; }
.level-1 { background:#e7f7ea; color:#236b34; }
.level-2 { background:#fff3d9; color:#7c5714; }
.level-3 { background:#f7e8ff; color:#6b2b86; }
.story-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }
.story-card { padding:22px; border:1px solid var(--border); border-radius:var(--radius); background:#fff; box-shadow:0 6px 22px rgba(31,41,55,.05); }
.story-card h2 { margin:12px 0 8px; font-size:1.25rem; }
.story-card p { color:var(--muted); min-height:74px; }
.story-meta { display:flex; justify-content:space-between; gap:12px; align-items:center; color:var(--muted); font-size:.9rem; }
.story-article { max-width:820px; }
.reading-text { margin:22px 0; padding:clamp(20px,4vw,34px); background:#fff; border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); font-size:1.16rem; line-height:1.9; }
.reading-text p { margin:0 0 1.15em; }
.reading-text p:last-child { margin-bottom:0; }
.comprehension { margin-top:34px; padding-top:8px; }
.story-nav { margin-top:36px; display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; padding-top:20px; border-top:1px solid var(--border); }
.story-nav a { font-weight:750; text-decoration:none; }
.exercise-layout { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }
.exercise-card { position:relative; padding:24px; background:#fff; border:1px solid var(--border); border-radius:var(--radius); box-shadow:0 6px 22px rgba(31,41,55,.05); }
.exercise-number { display:grid; place-items:center; width:34px; height:34px; border-radius:50%; background:#e9f0ff; color:var(--primary-dark); font-weight:900; }
.exercise-card h2 { margin:12px 0 6px; font-size:1.28rem; }
.option-row { display:flex; flex-wrap:wrap; gap:8px; margin:14px 0; }
.option-row button, .option-column button { background:#eef4ff; color:var(--primary-dark); border:1px solid #ccd9fa; }
.option-column { display:grid; gap:8px; margin:14px 0; }
.built-word { min-height:38px; padding:8px 10px; background:#f7f8fc; border-radius:9px; font-weight:800; }
.exercise-feedback { min-height:48px; font-weight:700; }
.value-section { padding-bottom:8px; }
.site-footer strong { color:#fff; }
.site-footer p { color:#b9c6d8; margin:.35rem 0 0; max-width:46ch; }

@media (max-width: 950px) {
  .cards-4, .story-grid, .exercise-layout { grid-template-columns:repeat(2,1fr); }
  .syllable-family { grid-template-columns:60px repeat(3,1fr); }
}
@media (max-width: 680px) {
  .cards-4, .story-grid, .exercise-layout, .level-guide, .sentence-grid { grid-template-columns:1fr; }
  .syllable-family { grid-template-columns:52px repeat(2,1fr); }
  .site-nav { width:100%; overflow-x:auto; flex-wrap:nowrap; padding-bottom:4px; }
  .site-nav a { white-space:nowrap; }
  .story-card p { min-height:0; }
}


/* NaukaCzytania 2.1 – richer learning content */
.breadcrumbs { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin:0 0 20px; font-size:.9rem; color:var(--muted); }
.breadcrumbs a { text-decoration:none; font-weight:700; }
.story-focus { margin:22px 0; padding:18px 20px; border-left:4px solid var(--primary); background:#eef4ff; border-radius:0 14px 14px 0; }
.story-focus h2 { margin:0 0 6px; font-size:1.12rem; }
.story-focus p { margin:0; }
.vocab-section, .unique-exercise, .story-next { margin-top:34px; }
.vocab-list { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; margin:18px 0 0; }
.vocab-item { padding:15px; border:1px solid var(--border); border-radius:13px; background:#fff; }
.vocab-item dt { font-weight:900; color:var(--primary-dark); margin-bottom:5px; }
.vocab-item dd { margin:0; color:var(--muted); }
.unique-exercise { padding:20px 22px; border-radius:16px; border:1px solid #d9e7d8; background:#f2faf1; }
.unique-exercise h2 { margin-top:0; }
.cards-2 { display:grid; grid-template-columns:repeat(2,1fr); gap:16px; }
.compact-card { padding:18px; }
.compact-card h3 { margin-top:0; }
.story-level-section { margin:54px 0; scroll-margin-top:90px; }
.story-level-section .section-heading h2 { margin-top:.45rem; }
.story-card-focus { font-size:.9rem; min-height:0 !important; }
.library-intro { margin-bottom:34px; }
.center-row { justify-content:center; }
.learning-detail-grid .content-card { min-height:100%; }
.timeline-list { counter-reset:step; list-style:none; padding:0; display:grid; gap:12px; margin:20px 0 34px; }
.timeline-list li { position:relative; padding:18px 20px 18px 58px; border:1px solid var(--border); background:#fff; border-radius:14px; }
.timeline-list li::before { counter-increment:step; content:counter(step); position:absolute; left:16px; top:16px; width:30px; height:30px; display:grid; place-items:center; border-radius:50%; background:var(--primary); color:#fff; font-weight:900; }
.difficulty-signals { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; margin:20px 0 34px; }
.difficulty-signals>div { padding:18px; border-radius:14px; border:1px solid var(--border); background:#fff; }
.difficulty-signals h3 { margin-top:0; }
.library-callout { border-top:1px solid var(--border); }
@media (max-width: 760px) {
  .vocab-list, .cards-2, .difficulty-signals { grid-template-columns:1fr; }
}
