:root {
  --primary: #0f766e;
  --primary-dark: #115e59;
  --accent: #d97706;
  --ink: #17201f;
  --muted: #667270;
  --line: #dce3e1;
  --background: #f7f9f8;
  --surface: #ffffff;
  --radius-sm: 6px;
  --radius-md: 10px;
  --shadow: 0 12px 34px rgba(23, 32, 31, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Tahoma, Arial, sans-serif;
  line-height: 1.7;
}
button, input, select { font: inherit; }
a { color: var(--primary-dark); }
.skip-link { position: fixed; top: -80px; right: 1rem; z-index: 2000; background: var(--ink); color: white; padding: .6rem 1rem; }
.skip-link:focus { top: 1rem; }
:focus-visible { outline: 3px solid rgba(15, 118, 110, .28); outline-offset: 3px; }

.site-header { background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.navbar { min-height: 66px; }
.navbar-brand { color: var(--ink); font-weight: 800; font-size: 1.18rem; }
.navbar-brand:hover { color: var(--primary); }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; background: var(--primary); color: white; border-radius: var(--radius-sm); }
.nav-link { color: #42504e; font-weight: 650; font-size: .94rem; border-radius: var(--radius-sm); padding-inline: .75rem !important; }
.nav-link:hover { color: var(--primary-dark); background: #edf5f3; }

.hero { background: var(--surface); border-bottom: 1px solid var(--line); }
.py-lg-6 { padding-top: 5.5rem !important; padding-bottom: 5.5rem !important; }
.eyebrow { display: inline-block; color: var(--primary-dark); font-weight: 800; font-size: .76rem; letter-spacing: .04em; margin-bottom: .55rem; }
h1, h2, h3 { letter-spacing: -.025em; line-height: 1.25; font-weight: 800; }
h1 { font-size: clamp(2.35rem, 6vw, 4.65rem); max-width: 760px; margin: 0; }
h1 span { color: var(--primary); }
.hero-copy { color: var(--muted); max-width: 650px; font-size: 1.08rem; margin: 1.25rem 0 0; }
.btn { border-radius: var(--radius-sm); font-weight: 750; padding: .62rem 1.1rem; }
.btn-lg { padding: .78rem 1.35rem; font-size: 1rem; }
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-dark); --bs-btn-hover-border-color: var(--primary-dark); --bs-btn-active-bg: var(--primary-dark); }
.hero-preview { min-height: 340px; border: 1px solid var(--line); box-shadow: var(--shadow); background: #fbfcfc; border-radius: var(--radius-md); padding: 2rem; display: grid; grid-template-columns: 1fr 1fr; align-items: center; position: relative; overflow: hidden; }
.hero-preview::after { content: "أ ب ت"; position: absolute; inset-inline-end: -10px; bottom: -35px; color: #edf1f0; font-weight: 900; font-size: 5.5rem; letter-spacing: .08em; z-index: 0; }
.hero-preview > * { position: relative; z-index: 1; }
.preview-label { display: block; color: var(--muted); font-size: .85rem; }
.hero-preview strong { display: block; color: var(--primary); font-size: 7rem; line-height: 1; }
.preview-animal { font-size: 6rem; text-align: center; filter: grayscale(.12); }
.hero-preview p { font-weight: 800; font-size: 1.7rem; margin: 0; }
.sound-chip { justify-self: start; border: 1px solid var(--line); background: white; color: var(--ink); border-radius: var(--radius-sm); padding: .55rem .8rem; font-weight: 750; }
.sound-chip:hover { border-color: var(--primary); color: var(--primary-dark); }

.section { padding: 4.6rem 0; }
.section-muted { background: #eef2f1; border-block: 1px solid var(--line); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.section-heading h2 { font-size: clamp(1.65rem, 4vw, 2.35rem); margin: 0; }
.section-heading p { margin: 0; color: var(--muted); }
.letters-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .65rem; }
.letter-button { min-height: 88px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); display: grid; place-items: center; font-size: 2rem; font-weight: 850; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; position: relative; }
.letter-button:hover { transform: translateY(-2px); border-color: var(--primary); box-shadow: 0 8px 22px rgba(23,32,31,.07); }
.letter-button.active { background: var(--primary); color: white; border-color: var(--primary); }
.letter-button.learned:not(.active)::after { content: "✓"; position: absolute; top: 7px; left: 8px; color: var(--primary); font-size: .7rem; border: 1px solid #bcd5d1; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; }

.lesson-shell { display: grid; grid-template-columns: minmax(220px, .72fr) 2fr; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow); }
.lesson-sidebar { background: #17201f; color: white; padding: 2rem; }
.lesson-sidebar .eyebrow { color: #7dd3c7; }
.active-letter { font-size: 7.5rem; font-weight: 900; color: #85d4ca; line-height: 1.1; margin: 1rem 0; }
.lesson-sidebar h2 { font-size: 1.45rem; }
.lesson-sidebar p { color: #bdc7c5; font-size: .92rem; min-height: 55px; }
.lesson-content { padding: 2rem; min-width: 0; }
.lesson-content h3 { font-size: 1.28rem; margin: 0; }
.lesson-count { color: var(--muted); white-space: nowrap; font-size: .85rem; }
.animal-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
.animal-card { background: #f8faf9; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1.25rem; min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.animal-visual { font-size: 5.6rem; line-height: 1.2; }
.animal-card h4 { font-size: 1.35rem; font-weight: 850; margin: .55rem 0 .1rem; }
.animal-card p { color: var(--muted); font-size: .84rem; margin: 0 0 .75rem; }
.animal-card button { border: 0; background: transparent; color: var(--primary-dark); font-weight: 800; padding: .3rem .5rem; }

.quiz-card { max-width: 820px; margin: auto; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-md); padding: clamp(1.35rem, 4vw, 2.4rem); box-shadow: var(--shadow); }
.quiz-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: .83rem; }
.quiz-progress { height: 5px; margin-bottom: 2rem; background: #e7eceb; }
.quiz-progress .progress-bar { background: var(--primary); transition: width .25s ease; }
.quiz-prompt { font-size: clamp(1.35rem, 4vw, 1.8rem); font-weight: 800; text-align: center; margin-bottom: 1.5rem; }
.quiz-prompt strong { color: var(--primary); font-size: 1.45em; }
.quiz-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.quiz-option { border: 1px solid var(--line); background: #fbfcfc; border-radius: var(--radius-sm); padding: 1rem .5rem; min-height: 130px; font-weight: 800; transition: border-color .15s, background .15s; }
.quiz-option span { display: block; font-size: 3rem; margin-bottom: .35rem; }
.quiz-option:hover:not(:disabled) { border-color: var(--primary); background: #f0f7f6; }
.quiz-option.correct { border-color: var(--primary); background: #e8f5f2; color: var(--primary-dark); }
.quiz-option.wrong { border-color: #b45309; background: #fff7ed; color: #92400e; }
.quiz-feedback { text-align: center; min-height: 28px; margin: 1rem 0 0; font-weight: 750; }
.quiz-result { text-align: center; padding: 1rem; }
.result-icon { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 1rem; border-radius: 50%; background: var(--primary); color: white; font-size: 1.6rem; }

.progress-panel { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.stat-card, .learned-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1.25rem; }
.stat-card strong { display: block; color: var(--primary-dark); font-size: 2rem; line-height: 1.2; }
.stat-card span { color: var(--muted); font-size: .85rem; }
.learned-card { grid-column: 1 / -1; }
.learned-card h3 { font-size: 1rem; margin-bottom: .8rem; }
.learned-list { display: flex; flex-wrap: wrap; gap: .45rem; color: var(--muted); }
.learned-pill { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid #bcd5d1; background: #edf7f5; color: var(--primary-dark); font-weight: 850; border-radius: var(--radius-sm); }
.empty-progress { font-size: .9rem; }

.site-footer { background: #17201f; color: #cbd3d1; padding: 1.4rem 0; font-size: .85rem; }
.site-footer p { margin: 0; }
.site-footer a { color: white; text-decoration: none; }
.toast { border-radius: var(--radius-sm); border-color: var(--line); }

@media (min-width: 768px) { .letters-grid { grid-template-columns: repeat(8, 1fr); } }
@media (max-width: 767.98px) {
  .py-lg-6 { padding-top: 3.8rem !important; padding-bottom: 3.8rem !important; }
  .hero-preview { min-height: 260px; }
  .hero-preview strong { font-size: 5.5rem; }
  .preview-animal { font-size: 4.6rem; }
  .section { padding: 3.5rem 0; }
  .section-heading { align-items: start; flex-direction: column; }
  .lesson-shell { grid-template-columns: 1fr; }
  .lesson-sidebar { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1rem; align-items: center; }
  .lesson-sidebar .eyebrow, .lesson-sidebar .btn { grid-column: 1 / -1; }
  .active-letter { grid-row: 2 / 4; font-size: 5rem; margin: 0; }
  .lesson-sidebar h2, .lesson-sidebar p { margin: 0; min-height: auto; }
  .lesson-content { padding: 1.25rem; }
  .quiz-options { grid-template-columns: 1fr; }
  .quiz-option { min-height: 82px; display: flex; align-items: center; justify-content: center; gap: .7rem; }
  .quiz-option span { margin: 0; font-size: 2.3rem; }
}
@media (max-width: 480px) {
  .letters-grid { grid-template-columns: repeat(4, 1fr); }
  .animal-grid { grid-template-columns: 1fr; }
  .progress-panel { grid-template-columns: 1fr; }
  .learned-card { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition-duration: .01ms !important; } }
