:root{
  --blue:#1769aa;
  --blue-dark:#0f4f82;
  --gold:#f4b942;
  --cream:#fffaf0;
  --green:#22a06b;
  --red:#d9534f;
  --text:#172033;
  --muted:#718096;
  --border:#dce3eb;
}

*{box-sizing:border-box}

body{
  margin:0;
  font-family:Arial,Helvetica,sans-serif;
  background:linear-gradient(180deg,#eef7ff 0%,#fffaf0 100%);
  color:var(--text);
}

button{
  font:inherit;
}

.topbar{
  background:white;
  border-bottom:1px solid var(--border);
  padding:14px 20px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:15px;
  position:sticky;
  top:0;
  z-index:10;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
}

.brand-logo{
  width:45px;
  height:45px;
  border-radius:14px;
  display:grid;
  place-items:center;
  background:var(--blue);
  color:white;
  font-size:25px;
  font-weight:bold;
}

.brand strong{
  display:block;
  font-size:20px;
}

.brand small{
  color:var(--muted);
}

.stats{
  display:flex;
  gap:8px;
}

.stat{
  background:#f5f8fc;
  border:1px solid var(--border);
  border-radius:14px;
  padding:8px 12px;
  font-weight:bold;
}

.container{
  max-width:1050px;
  margin:auto;
  padding:25px 18px 45px;
}

.hero{
  background:linear-gradient(135deg,var(--blue),#2d8bd1);
  color:white;
  border-radius:28px;
  padding:35px;
  margin-bottom:25px;
  position:relative;
  overflow:hidden;
  box-shadow:0 18px 40px #1769aa30;
}

.hero h1{
  margin:0 0 8px;
  font-size:38px;
}

.hero p{
  margin:0 0 22px;
  opacity:.92;
}

.hero-arabic{
  position:absolute;
  right:30px;
  bottom:-15px;
  font-size:110px;
  direction:rtl;
  opacity:.16;
}

.primary-btn{
  border:0;
  border-radius:15px;
  padding:13px 20px;
  background:var(--gold);
  color:#382500;
  font-weight:bold;
  cursor:pointer;
  box-shadow:0 5px 0 #d49b25;
}

.primary-btn:active{
  transform:translateY(3px);
  box-shadow:0 2px 0 #d49b25;
}

.progress-card{
  background:white;
  border:1px solid var(--border);
  border-radius:20px;
  padding:18px;
  margin-bottom:25px;
}

.progress-head{
  display:flex;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
  font-weight:bold;
}

.progress-track{
  height:13px;
  background:#e8edf3;
  border-radius:20px;
  overflow:hidden;
}

.progress-bar{
  height:100%;
  width:0;
  background:linear-gradient(90deg,var(--gold),#ffd66b);
  border-radius:20px;
  transition:width .4s ease;
}

.section-title{
  margin:25px 0 14px;
}

.lessons-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:14px;
}

.lesson{
  border:1px solid var(--border);
  background:white;
  border-radius:20px;
  padding:17px;
  min-height:165px;
  text-align:left;
  cursor:pointer;
  transition:.2s;
  box-shadow:0 5px 18px #1720330d;
}

.lesson:hover:not(:disabled){
  transform:translateY(-3px);
  box-shadow:0 12px 25px #17203318;
  border-color:#a9c8e2;
}

.lesson:disabled{
  cursor:not-allowed;
}

.lesson.locked{
  opacity:.55;
  background:#f4f5f7;
}

.lesson.done{
  border-color:#9bd9bd;
  background:#f3fcf7;
}

.lesson-number{
  color:var(--muted);
  font-size:11px;
  font-weight:bold;
}

.lesson-icon{
  font-size:32px;
  margin:8px 0;
}

.lesson h3{
  margin:5px 0 10px;
  font-size:16px;
}

.lesson-status{
  font-size:12px;
  font-weight:bold;
  color:var(--blue);
}

.lesson.done .lesson-status{
  color:var(--green);
}

.lesson-shell{
  max-width:760px;
  margin:auto;
}

.lesson-header{
  display:flex;
  justify-content:space-between;
  gap:15px;
  align-items:center;
  margin-bottom:18px;
}

.lesson-header h2{
  margin:4px 0;
}

.lesson-description{
  color:var(--muted);
}

.letter-board{
  display:flex;
  justify-content:center;
  flex-wrap:wrap;
  gap:12px;
  margin:20px 0;
}

.letter{
  width:82px;
  height:82px;
  border-radius:20px;
  display:grid;
  place-items:center;
  background:white;
  border:2px solid #dce8f3;
  font-family:serif;
  font-size:45px;
  box-shadow:0 8px 20px #17203312;
}

.lesson-card{
  background:white;
  border:1px solid var(--border);
  border-radius:25px;
  padding:25px;
  box-shadow:0 12px 35px #17203312;
}

.question-meta{
  display:flex;
  justify-content:space-between;
  color:var(--muted);
  font-size:13px;
  margin-bottom:15px;
}

.target{
  text-align:center;
  margin:20px 0;
}

.target-letter{
  font-family:serif;
  font-size:100px;
  direction:rtl;
  line-height:1;
  margin:15px 0;
}

.listen-btn{
  border:1px solid var(--border);
  background:#f6f9fc;
  border-radius:12px;
  padding:9px 14px;
  cursor:pointer;
}

.answers{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:12px;
  margin-top:20px;
}

.answer{
  min-height:75px;
  border:2px solid #dce3eb;
  background:white;
  border-radius:17px;
  font-family:serif;
  font-size:38px;
  cursor:pointer;
  direction:rtl;
  transition:.15s;
}

.answer:hover:not(:disabled){
  border-color:var(--blue);
  background:#f1f8ff;
}

.answer:disabled{
  cursor:default;
}

.answer.correct{
  border-color:var(--green);
  background:#e4f7ee;
}

.answer.wrong{
  border-color:var(--red);
  background:#fdeaea;
}

.feedback{
  margin:16px 0;
  padding:13px;
  border-radius:12px;
  font-weight:bold;
}

.feedback.good{
  background:#e4f7ee;
  color:#16764d;
}

.feedback.bad{
  background:#fdeaea;
  color:#a52f2f;
}

.next-row{
  display:flex;
  justify-content:flex-end;
  margin-top:15px;
}

.result-card{
  max-width:650px;
  margin:35px auto;
  text-align:center;
  background:white;
  border:1px solid var(--border);
  border-radius:28px;
  padding:40px 25px;
  box-shadow:0 15px 45px #17203316;
}

.result-emoji{
  font-size:70px;
}

.result-card h2{
  font-size:32px;
  margin:5px 0;
}

.result-stats{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:10px;
  margin:25px 0;
}

.result-stats div{
  background:#f7f8fa;
  border-radius:15px;
  padding:15px 8px;
}

.result-stats strong,
.result-stats span{
  display:block;
}

.result-stats strong{
  font-size:20px;
  color:var(--blue);
}

.result-stats span{
  color:var(--muted);
  font-size:12px;
  margin-top:4px;
}

.result-actions{
  display:flex;
  justify-content:center;
  gap:10px;
  flex-wrap:wrap;
}

.secondary-btn{
  border:1px solid var(--border);
  background:white;
  color:var(--text);
  border-radius:14px;
  padding:12px 18px;
  font-weight:bold;
  cursor:pointer;
}

footer{
  text-align:center;
  padding:25px;
  color:#7b8494;
  font-size:13px;
}

.hidden{
  display:none !important;
}

@media(max-width:800px){
  .lessons-grid{
    grid-template-columns:repeat(2,1fr);
  }

  .hero-arabic{
    display:none;
  }

  .hero h1{
    font-size:30px;
  }
}

@media(max-width:500px){
  .topbar{
    align-items:flex-start;
  }

  .brand small{
    display:none;
  }

  .stats{
    gap:5px;
  }

  .stat{
    padding:7px 9px;
    font-size:13px;
  }

  .container{
    padding:15px 12px 35px;
  }

  .hero{
    padding:25px 20px;
    border-radius:22px;
  }

  .lessons-grid{
    grid-template-columns:1fr 1fr;
    gap:9px;
  }

  .lesson{
    padding:13px;
    min-height:140px;
  }

  .lesson h3{
    font-size:14px;
  }

  .lesson-header{
    align-items:flex-start;
    flex-direction:column;
  }

  .answers{
    gap:8px;
  }

  .result-stats{
    gap:6px;
  }

  .target-letter{
    font-size:80px;
  }
}
