/* Mobile pass (v27): phone-first chrome, compact level tabs, readable bilingual footer. */
.site-footer .footer-line{display:block}
.site-footer .footer-ar,.site-footer .footer-en{unicode-bidi:isolate}
.site-footer .footer-en{direction:ltr;text-align:start}
.site-footer .footer-sep{opacity:.55;margin-inline:.3em}
@media (max-width:640px){.site-footer .footer-ar,.site-footer .footer-en{display:block}}

/* breadcrumb links were 17px tall on every screen: real tap target */
.crumb a{display:inline-block;padding-block:.55rem;padding-inline:.15rem}

@media (max-width:640px){
  /* header chrome: tighter rows, smaller switchers, install button no longer a full row */
  .site-header-inner{gap:.35rem .45rem;padding-block:.45rem}
  .brand{font-size:.95rem;line-height:1.25}
  .brand-en{display:none}
  .lang-switcher button,.theme-switcher button{padding:.2rem .45rem;font-size:.72rem;min-height:32px}
  .site-header .button{padding:.28rem .55rem;font-size:.76rem;min-height:32px}

  /* level tabs: one horizontally scrolling row instead of four stacked rows */
  .pills{display:flex;flex-wrap:nowrap;overflow-x:auto;gap:.4rem;padding-block:.15rem .45rem;-webkit-overflow-scrolling:touch;scrollbar-width:none}
  .pills::-webkit-scrollbar{display:none}
  .pill{flex:0 0 auto;white-space:nowrap;font-size:.8rem;padding:.4rem .7rem;min-height:36px}

  /* less stacked text before the lesson itself */
  .page-head{margin-bottom:.25rem}
  .page-head .muted{font-size:.85rem}
  .crumb{font-size:.8rem;margin-block:.3rem}
  .notice{font-size:.78rem;padding:.5rem .6rem;margin-block:.5rem;line-height:1.55}
  article>p:first-child{margin-top:.25rem}
}

@media (max-width:640px){.site-footer .footer-sep{display:none}}

/* Situations (v37): visible break between scenes of a stitched situation */
.scene-break{display:block;margin:1.1rem 0 .5rem;padding-top:.6rem;border-top:1px dashed rgba(120,120,120,.45);font-size:.8rem;line-height:1.5}
.scene-break-ar{display:block;font-weight:600}
.scene-break-en{display:block;opacity:.72;font-size:.75rem}

/* Exam transcripts (v78): one turn per line, same look as the lesson dialogues */
.exam-dialogue{margin:.6rem 0}
.exam-dialogue .library-line{max-width:100%}

/* v109 — dialogue as a table (design pass, item 1). One row per turn:
   speaker | English | audio | Arabic, in aligned columns instead of a stack. */
.library-dialogue.dlg-table{display:block;border-top:1px solid var(--border,#e3ddd0);margin-top:.35rem}
.dlg-table .dlg-head{display:grid;grid-template-columns:6.5rem minmax(0,1fr) 2.4rem minmax(0,1fr);gap:.4rem 1rem;padding:.4rem .4rem .45rem;font-size:.76rem;font-weight:600;letter-spacing:.01em;color:var(--muted,#5c6670);border-bottom:1px solid var(--border-strong,#cfc7b4)}
.dlg-table .dlg-head span{white-space:nowrap}
.dlg-table .library-line{display:grid;grid-template-columns:6.5rem minmax(0,1fr) 2.4rem minmax(0,1fr);gap:.4rem 1rem;align-items:start;padding:.5rem .4rem;border-bottom:1px solid var(--border,#e3ddd0);max-width:100%}
.dlg-table .library-line-alt{background:rgba(120,120,120,.035)}
.dlg-table .library-line .library-speaker{grid-column:1;grid-row:1;align-self:start;font-size:.82rem;font-weight:600;color:var(--teal,#0e4a5a);opacity:1;line-height:1.6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dlg-table .library-line p{grid-column:2;grid-row:1;margin:0;line-height:1.65}
.dlg-table .library-line .speak-btn{grid-column:3;grid-row:1;justify-self:center;align-self:start;margin-top:.1rem}
.dlg-table .library-line .sentence-ar{grid-column:4;grid-row:1;margin:0;font-size:.95em;line-height:1.75;color:var(--text,#1c2530)}
.dlg-table .library-line>*{min-width:0}
.dlg-table .dlg-empty{opacity:0}
@media (max-width:820px){
  .dlg-table .dlg-head{display:none}
  .dlg-table .library-line{grid-template-columns:auto minmax(0,1fr) 2.2rem;gap:.2rem .5rem;padding:.55rem .1rem}
  .dlg-table .library-line .library-speaker{grid-column:1;grid-row:1;white-space:normal}
  .dlg-table .library-line p{grid-column:2;grid-row:1}
  .dlg-table .library-line .speak-btn{grid-column:3;grid-row:1}
  .dlg-table .library-line .sentence-ar{grid-column:1/-1;grid-row:2;padding-top:.1rem}
}

/* v111 — design pass, item 2: vocabulary and grammar as tables. */
/* A. lesson "new words" list */
ul.lesson-list.vocab-table{display:block}
.vocab-head,.vocab-table>li{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(0,1fr) 2.4rem;gap:.25rem 1rem;align-items:center;padding:.42rem .35rem;border-bottom:1px solid var(--border,#e3ddd0)}
.vocab-head{font-size:.76rem;font-weight:600;color:var(--muted,#5c6670);border-bottom:1px solid var(--border-strong,#cfc7b4)}
.vocab-table>li>span[lang="en"]{grid-column:1;grid-row:1;display:flex;align-items:baseline;gap:.35rem;flex-wrap:wrap}
.vocab-table>li>span[lang="en"] strong{font-weight:600;font-size:1rem}
.vocab-table>li>span:not([lang]){grid-column:2;grid-row:1;font-weight:600}
.vocab-table>li>.speak-btn{grid-column:3;grid-row:1;justify-self:center}
.vocab-table>li{border-radius:0;background:none}
/* B. grammar examples */
ul.lesson-list.grammar-table{display:block}
.gram-head,.grammar-table>li{display:grid;grid-template-columns:minmax(0,1fr) 2.4rem minmax(0,1fr);gap:.25rem 1rem;align-items:start;padding:.42rem .35rem;border-bottom:1px solid var(--border,#e3ddd0)}
.gram-head{font-size:.76rem;font-weight:600;color:var(--muted,#5c6670);border-bottom:1px solid var(--border-strong,#cfc7b4)}
.grammar-table>li>span[lang="en"]{grid-column:1;grid-row:1}
.grammar-table>li>.speak-btn{grid-column:2;grid-row:1;justify-self:center}
.grammar-table>li>span[lang="ar"]{grid-column:3;grid-row:1;margin:0;font-size:.95em;line-height:1.7}
.grammar-table>li{border-radius:0;background:none}
/* C. vocabulary page */
.library-word-grid.word-table{display:block}
.wt-head,.word-table article.library-word{display:grid;grid-template-columns:9.5rem 11.5rem 13rem minmax(0,1fr) 8rem;gap:.3rem 1.1rem;align-items:start}
.wt-head{padding:.45rem .5rem;font-size:.76rem;font-weight:600;color:var(--muted,#5c6670);border-bottom:1px solid var(--border-strong,#cfc7b4)}
.word-table article.library-word{padding:.7rem .5rem;border:0;border-bottom:1px solid var(--border,#e3ddd0);border-radius:0;box-shadow:none;background:none}
.word-table article.library-word:nth-of-type(even){background:rgba(120,120,120,.045)}
.word-table .wcol-word{grid-column:1;grid-row:1}
.word-table .wcol-word h3{margin:0;font-size:1.02rem;line-height:1.4}
.word-table .wcol-ipa{grid-column:2;grid-row:1;margin:0;font-size:.78rem;line-height:1.55}
.word-table .wcol-ipa span{display:block}
.word-table .wcol-mean{grid-column:3;grid-row:1;margin:0;font-weight:600}
.word-table .wcol-def{grid-column:3;grid-row:2;margin:0;font-size:.82rem;line-height:1.6;color:var(--muted,#5c6670)}
.word-table .wcol-ex{grid-column:4;margin:0;font-size:.9rem;line-height:1.6}
.word-table .wcol-ex.muted,.word-table p.muted.wcol-ex{color:var(--muted,#5c6670);font-size:.82rem}
.word-table .wcol-acts{grid-column:5;grid-row:1;display:flex;flex-direction:column;gap:.3rem;align-items:stretch}
.word-table .wcol-acts .pill{font-size:.74rem;padding:.25rem .4rem;min-height:30px}
@media (max-width:900px){
  .library-word-grid.word-table{display:grid}
  .wt-head{display:none}
  .word-table article.library-word{display:block;padding:.9rem;border:1px solid var(--border,#e3ddd0);border-radius:14px;margin-bottom:.7rem;background:var(--surface,#fff)}
  .word-table article.library-word:nth-of-type(even){background:var(--surface,#fff)}
  .word-table .wcol-acts{flex-direction:row}
  .vocab-head,.gram-head{display:none}
  .vocab-table>li,.grammar-table>li{grid-template-columns:minmax(0,1fr) 2.2rem;gap:.2rem .5rem}
  .vocab-table>li>span[lang="en"]{grid-column:1;grid-row:1}
  .vocab-table>li>span:not([lang]){grid-column:1;grid-row:2;font-size:.92rem}
  .vocab-table>li>.speak-btn{grid-column:2;grid-row:1}
  .grammar-table>li>span[lang="en"]{grid-column:1;grid-row:1}
  .grammar-table>li>.speak-btn{grid-column:2;grid-row:1}
  .grammar-table>li>span[lang="ar"]{grid-column:1/-1;grid-row:2}
  .ex-head{display:none}
  .ex-table>li{grid-template-columns:minmax(0,1fr) 2.2rem}
  .ex-table>li>span[lang="en"]{grid-column:1;grid-row:1}
  .ex-table>li>.speak-btn{grid-column:2;grid-row:1}
  .ex-table>li>.sentence-ar{grid-column:1/-1;grid-row:2}
}

/* E. lesson example list (same shape as the grammar examples) */
ul.lesson-list.ex-table{display:block}
.ex-head,.ex-table>li{display:grid;grid-template-columns:minmax(0,1fr) 2.4rem minmax(0,1fr);gap:.25rem 1rem;align-items:start;padding:.42rem .35rem;border-bottom:1px solid var(--border,#e3ddd0)}
.ex-head{font-size:.76rem;font-weight:600;color:var(--muted,#5c6670);border-bottom:1px solid var(--border-strong,#cfc7b4)}
.ex-table>li>span[lang="en"]{grid-column:1;grid-row:1}
.ex-table>li>.speak-btn{grid-column:2;grid-row:1;justify-self:center}
.ex-table>li>.sentence-ar{grid-column:3;grid-row:1;margin:0;font-size:.95em;line-height:1.7}
.ex-table.ex-partial>li{grid-template-columns:minmax(0,1fr) 2.4rem}
.ex-table.ex-partial>li>span[lang="en"]{grid-column:1;grid-row:1}
.ex-table.ex-partial>li>.speak-btn{grid-column:2;grid-row:1}
.ex-table.ex-partial>li>.sentence-ar{grid-column:1;grid-row:2;padding-top:.1rem}
.ex-table>li{border-radius:0;background:none}
/* D. English-only transcripts: no empty Arabic column */
.dlg-table.dlg-noar .dlg-head,.dlg-table.dlg-noar .library-line{grid-template-columns:6.5rem minmax(0,1fr) 2.4rem}
.dlg-table.dlg-noar .dlg-head span:nth-child(4),.dlg-table.dlg-noar .sentence-ar{display:none}

/* v115 — consistency pass: one card rhythm and one heading scale across the app. */
main .card{padding:20px}
main .card>.page-head{margin-bottom:0}
@media (max-width:640px){main .card{padding:16px}}

/* v116 — less Arabic explanation on screen: long grammar intros fold behind «المزيد».
   The paragraph is never removed; it is clamped to two lines until the reader opens it. */
.gram-exp{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.gram-exp.open{display:block;-webkit-line-clamp:unset;overflow:visible}
.gram-more{display:inline-flex;align-items:center;gap:.25rem;margin-top:.35rem;padding:.2rem .55rem;min-height:30px;font-size:.78rem;font-weight:600;color:var(--teal,#0e4a5a);background:transparent;border:1px solid var(--border-strong,#cfc7b4);border-radius:999px;cursor:pointer}
.gram-more:hover{background:var(--teal-soft,#e8f0f2)}
.gram-more:focus-visible{outline:2px solid var(--teal,#0e4a5a);outline-offset:2px}

/* v117 — illustrations (sample on the home page): line art in the app's own palette. */
.ill{width:64px;height:64px;display:block}
.ill-tile{display:inline-flex;align-items:center;justify-content:center;width:84px;height:84px;border-radius:20px;background:var(--teal-soft,#e8f0f2);margin:0 0 .6rem}
.ill-tile.gold{background:var(--gold-soft,#f7ecd4)}
.path-card .ill-tile{width:92px;height:92px;border-radius:22px}
@media (max-width:640px){.ill{width:50px;height:50px}.ill-tile,.path-card .ill-tile{width:68px;height:68px;border-radius:16px;margin-bottom:.45rem}}

/* v120 — consistency pass: one heading scale, one breadcrumb position. */
main .page-head h1{line-height:1.25}
main .card h2,main section h2{font-size:1.25rem;line-height:1.35}
main .page-head + .crumb,main .crumb{font-size:.85rem}
main .page-head{margin-bottom:.35rem}

/* v126 — reference tables on the grammar page: pronouns, be, present simple. */
.ref-card{margin-top:.9rem}
.ref-card h2{font-size:1.15rem;margin:0 0 .35rem}
.ref-card h3{font-size:.98rem;margin:1rem 0 .3rem;color:var(--muted,#5c6670)}
.ref-sub{font-size:.85rem;color:var(--muted,#5c6670);margin:0 0 .5rem}
.ref-t{width:100%;border-collapse:collapse;font-size:.92rem}
.ref-t th,.ref-t td{text-align:start;padding:.42rem .5rem;border-bottom:1px solid var(--border,#e3ddd0);vertical-align:top}
.ref-t th{font-size:.78rem;font-weight:600;color:var(--muted,#5c6670)}
.ref-t td.en{direction:ltr;unicode-bidi:isolate}
.ref-t td.ar{font-weight:600}
.ref-t td.ex{font-size:.85rem;color:var(--muted,#5c6670)}
.ref-t tr:nth-of-type(even) td{background:rgba(120,120,120,.045)}
@media (max-width:760px){.ref-t{font-size:.85rem}.ref-t td.ex,.ref-t th.ex{display:none}}

/* v148 — illustrations on level cards and lesson headers */
.unit-head .ill-tile{width:54px;height:54px;border-radius:14px;margin:0 .7rem 0 0;flex:0 0 auto}
[dir="rtl"] .unit-head .ill-tile{margin:0 0 0 .7rem}
.unit-head{display:flex;align-items:center;gap:.2rem}
.unit-head > :not(.ill-tile){min-width:0}
main section.card > .ill-tile{width:60px;height:60px;border-radius:16px;margin:0 0 .7rem}
@media (max-width:640px){.unit-head .ill-tile{width:42px;height:42px;border-radius:12px}}

/* v149 - lessons index header. .unit-head was a flex row with
   justify-content:space-between, which pushed the unit title into the middle of
   the card and the lesson-count badge to the far right. Grid instead: the
   illustration sits on the left spanning both rows, the title starts right of
   it, and the badge sits under the title. */
.unit-head{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;column-gap:.9rem;row-gap:.2rem;justify-content:start}
.unit-head .ill-tile{grid-column:1;grid-row:1 / span 2;margin:0;align-self:center}
.unit-head h3{grid-column:2;grid-row:1;justify-self:start;text-align:start;margin:0}
.unit-head .badge{grid-column:2;grid-row:2;justify-self:start}


/* v152 - open on content instead of a dashboard of controls.
   The six foundation steps stay whole (main, 17:30): they are the content of
   that screen. What leaves the first screen is the theme switcher (one tap away
   behind a gear) and the install hint (one line, dismissible, remembered).
   The next step is marked on its own tile rather than in a block above the list
   (main, 17:33), so nothing is said twice.
   /library/: the four number tiles become one honest block of the same numbers;
   they open nothing today, so they stay information. */
.theme-switcher{display:none}
.theme-switcher.theme-open{display:inline-flex;position:fixed;top:3.2rem;right:.75rem;z-index:80;background:var(--surface);border:1px solid var(--border-strong);border-radius:10px;padding:.4rem;box-shadow:var(--shadow)}
.theme-gear{background:var(--surface);border:1px solid var(--border-strong);border-radius:8px;padding:.25rem .5rem;font-size:1rem;line-height:1;cursor:pointer;color:var(--text)}
.theme-gear[aria-expanded="true"]{border-color:var(--gold)}
.install-hint-x{background:none;border:0;color:var(--muted);line-height:1;cursor:pointer;padding:0 .2rem}
.quick-card.is-next-step{border:2px solid var(--gold);background:var(--surface-2,#f7f4ee)}
.quick-card .ns-flag{display:block;font-size:.66rem;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:var(--gold-dark,var(--gold));margin:0 0 .2rem}
.quick-card .ns-start{display:block;margin-top:.3rem;font-size:.78rem;font-weight:700;color:var(--gold-dark,var(--gold))}
.page-library .stat-grid{display:flex;flex-wrap:wrap;align-items:baseline;gap:.25rem 1.1rem;padding:.65rem .9rem;background:var(--surface-2,#f7f4ee);border:1px solid var(--border);border-radius:var(--radius);margin-block-end:1rem}
.page-library .stat-grid .stat-card{background:none;border:0;box-shadow:none;padding:0;display:flex;align-items:baseline;gap:.35rem}
.page-library .stat-grid .stat-num{font-size:1.05rem;font-weight:800;line-height:1.2}
.page-library .stat-grid .stat-label{font-size:.85rem;font-weight:600;color:var(--muted)}
