@font-face {
  font-family: Thmanyah; src: url(assets/thmanyah-regular.woff2) format("woff2");
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: Thmanyah; src: url(assets/thmanyah-medium.woff2) format("woff2");
  font-weight: 500; font-display: swap;
}
@font-face {
  font-family: Naskh; src: url(assets/naskh.woff) format("woff");
  font-weight: 400; font-display: swap;
}
:root {
  --paper: #f5f1e6; --surface: #fffdf5; --ink: #263f32; --green: #28523e;
  --muted: #54654f; --line: #d9d8c7; --sage: #e8ecdd; --gold: #d7bb79;
  --display: Naskh, "Traditional Arabic", serif;
  color: var(--ink); background: var(--paper); font: 16px/1.7 Thmanyah, Tahoma, sans-serif;
  font-synthesis: none;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
a { text-decoration: none; color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid #627e50; outline-offset: 4px;
}
.skip { position: absolute; inset: -80px 15px auto auto; z-index: 10; background: var(--surface); padding: 10px; }
.skip:focus { top: 10px; }
.mast {
  min-height: 80px; display: flex; gap: 18px; align-items: center; justify-content: space-between;
  padding: 12px max(25px, calc((100% - 1330px)/2)); border-bottom: 1px solid var(--line); background: #faf7ed;
}
.lab-brand { display: flex; gap: 10px; align-items: center; min-width: 0; }
.lab-brand > div { min-width: 0; }
.lab-brand > span {
  display: grid; place-items: center; width: 43px; height: 43px; color: #fff9e7; background: var(--green);
  border-radius: 14px 14px 5px 14px; font: 29px/1 var(--display); flex: none;
}
.lab-brand strong { font: 500 clamp(.91rem, 2.25vw, 1.12rem)/1.55 Thmanyah, Tahoma, sans-serif; display: block; }
.lab-brand small { font-size: .72rem; color: var(--muted); display: block; margin-top: 4px; }
.mast-label { font-size: .84rem; color: var(--muted); }
#projector {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px; min-height: 44px;
  border: 1px solid #bdc5ad; border-radius: 9px; background: transparent; font-size: .8rem;
}
#projector[aria-pressed=true] { background: var(--green); color: white; }
#projector svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; flex: none; }
.lab-layout {
  max-width: 1390px; margin: auto; padding: 38px 28px 60px;
  display: grid; grid-template-columns: minmax(224px, 275px) minmax(0, 1fr); gap: clamp(22px, 4vw, 62px); align-items: start;
}
.lesson-library {
  position: sticky; top: 20px; background: #faf7ef; border: 1px solid var(--line);
  border-radius: 15px; padding: 20px; min-width: 0;
}
.library-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.library-title h2 { font-weight: 500; font-size: 1rem; }
#lesson-count { font-size: .69rem; color: var(--muted); white-space: nowrap; }
.library-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 18px 0 15px; }
.library-filters label { min-width: 0; font-size: .72rem; color: var(--muted); }
.library-filters select, .library-filters input {
  width: 100%; background: var(--surface); border: 1px solid #c6cbb8; border-radius: 8px;
  min-height: 43px; padding: 7px; margin-top: 4px; color: var(--ink);
}
.search-label { grid-column: 1/-1; }
#library-details summary { cursor: pointer; color: var(--muted); font-size: .78rem; min-height: 42px; padding-top: 8px; }
#list-count { margin-inline-start: 6px; }
#lesson-list { max-height: min(44vh, 430px); overflow: auto; overscroll-behavior: contain; }
.group-label { color: var(--muted); font-size: .69rem; margin: 11px 5px 6px; }
.lesson-choice {
  display: flex; gap: 8px; align-items: center; justify-content: space-between;
  min-height: 42px; border-radius: 8px; padding: 8px; font-size: .82rem; line-height: 1.6;
}
.lesson-choice:hover { background: var(--sage); }
.lesson-choice[aria-current=page] { background: var(--green); color: var(--surface); }
.lesson-choice .done-mark { flex: none; font-size: .83rem; }
.library-foot { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; font-size: .69rem; color: var(--muted); }
#lesson-main { min-width: 0; }
.lesson-heading { margin-bottom: 24px; }
.lesson-meta { color: var(--muted); font-size: .77rem; margin-bottom: 10px; }
h1 { font: 400 clamp(38px, 4.3vw, 65px)/1.25 var(--display); overflow-wrap: anywhere; }
.rule {
  display: flex; align-items: flex-start; gap: 13px; background: var(--sage); padding: 15px 18px;
  margin-top: 18px; border: 1px solid #d4dbc6; border-radius: 12px;
}
.rule > span {
  width: 32px; height: 35px; display: grid; place-items: center; flex: none; font: 24px var(--display);
  background: #d5dec3; border-radius: 14px 14px 4px 4px;
}
.rule h2, .section-top h2 { font-weight: 500; font-size: 1rem; }
.rule p { margin-top: 4px; line-height: 1.85; font-size: .91rem; }
.workbench, .quiz-panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: clamp(17px, 3vw, 32px);
  margin-bottom: 21px;
}
.section-top { display: flex; gap: 12px; align-items: flex-start; }
.step-no {
  display: grid; place-items: center; width: 34px; height: 39px; flex: none; border-radius: 17px 17px 5px 5px;
  border: 1px solid #d9d0b4; background: #f4edda; color: #6d623d; font-size: .75rem;
}
.section-top p { color: var(--muted); font-size: .86rem; margin-top: 4px; }
.scene-options, .answer-options { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0; }
.scene-option, .answer, .quiz-next, .quiz-retry {
  background: #f7f5eb; border: 1px solid #c8cfbc; border-radius: 9px; min-height: 44px; padding: 8px 14px;
  font-size: .85rem; transition: background .2s, transform .25s;
}
.scene-option:hover, .answer:hover { background: #e6ecd9; transform: translateY(-2px); }
.scene-option[aria-pressed=true], .quiz-next { background: var(--green); color: #fff9ea; border-color: var(--green); }
.example-output {
  position: relative; padding: 16px 20px 19px; min-height: 198px; overflow: hidden;
  border: 1px solid #dcd7bd; border-radius: 9px 9px 23px 9px;
  background: linear-gradient(180deg,#f4efdc,#faf7e9);
}
.example-label { color: #665b3b; font-size: .74rem; }
.example-sentence {
  min-height: 101px; display: block; text-align: center; align-content: center;
  padding: 8px 0; font: 400 clamp(34px, 4.1vw, 55px)/1.7 var(--display); overflow-wrap: anywhere;
}
.example-sentence mark {
  color: #29583e; background: #e2dab2; border-radius: 5px;
  box-shadow: inset 0 -2px #c8a960; padding-block: .02em;
}
.example-note { color: #4c5c42; border-inline-start: 2px solid #b2c298; padding-inline-start: 10px; font-size: .88rem; }
.example-output.is-changing { animation: settle .38s ease-out; }
@keyframes settle { from { opacity: .55; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.text-button { border: 0; background: transparent; padding: 9px 0 0; min-height: 44px; font-size: .78rem; color: var(--green); }
.text-button span { margin-inline-start: 8px; }
.quiz-state { display: flex; gap: 6px; margin-top: 18px; font-size: .73rem; color: var(--muted); }
.quiz-question { margin-top: 12px; font-weight: 500; }
.answer-options { margin: 15px 0 9px; }
.answer.correct { background: #deecd5; border-color: #789367; color: #2c563e; }
.answer.try-again { background: #f8ecd4; border-color: #bc935e; }
.answer[aria-disabled=true] { cursor: default; }
.feedback { color: var(--muted); min-height: 32px; font-size: .83rem; padding-block: 4px; }
.quiz-next, .quiz-retry { margin-top: 10px; }
.quiz-complete { margin-top: 16px; background: var(--sage); border-radius: 9px; padding: 14px 16px; }
.lesson-pagination { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.lesson-pagination a { font-size: .8rem; padding: 9px 0; border-bottom: 1px solid #9fae91; min-height: 44px; }
.lab-footer {
  display: flex; justify-content: space-between; gap: 14px; border-top: 1px solid var(--line);
  padding: 19px max(25px, calc((100% - 1330px)/2)); font-size: .72rem; color: var(--muted);
}
.board-view .lab-layout { display: block; max-width: 1250px; }
.board-view .lesson-library { display: none; }
.board-view .example-sentence { font-size: clamp(42px, 6vw, 80px); }
.board-view .rule p, .board-view .section-top p, .board-view .example-note { font-size: 1.1rem; }
.no-script { padding: 20px; }
@media (max-width: 810px) {
  .lab-layout { padding: 20px 19px 37px; grid-template-columns: 1fr; gap: 21px; }
  .lesson-library { position: static; padding: 14px 16px 10px; }
  .library-filters { grid-template-columns: 1fr 1fr 1.6fr; margin: 10px 0 4px; }
  .search-label { grid-column: auto; }
  #lesson-list { max-height: 245px; }
  .library-foot { display: none; }
  .mast { min-height: 69px; padding-inline: 18px; }
  .mast-label { display: none; }
}
@media (max-width: 390px) {
  .lab-layout { padding-inline: 12px; }
  .mast { padding-inline: 12px; gap: 8px; }
  .lab-brand { gap: 7px; }
  .lab-brand > span { width: 33px; height: 35px; }
  .lab-brand strong { font-size: .85rem; }
  .lab-brand small { font-size: .62rem; }
  #projector { padding-inline: 8px; gap: 5px; font-size: .69rem; }
  .library-filters { grid-template-columns: 1fr 1fr; }
  .search-label { grid-column: 1/-1; }
  .scene-option, .answer { padding-inline: 9px; font-size: .79rem; }
  .example-output { padding-inline: 12px; }
  .lab-footer { padding-inline: 14px; }
}
.lesson-heading h1,.lesson-header h1{line-height:1.45;overflow-wrap:break-word}
@media(max-width:520px){
  .mast{gap:.55rem;flex-wrap:wrap}
  #projector{flex:none;margin-inline-start:auto}
  .lab-footer{flex-wrap:wrap;gap:.5rem 1rem}
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
