* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #1c2430; background: #f5f6f8;
  -webkit-tap-highlight-color: transparent; }
header { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: #1f3a5f; color: #fff; font-size: 14px; }
header .doux { color: #c9d6e8; }
.espace { flex: 1; }
.lien { background: none; border: 0; color: #fff; text-decoration: underline; font-size: 14px; padding: 4px; cursor: pointer; }
main { max-width: 760px; margin: 0 auto; padding: 10px 10px 40px; }
.doux { color: #6b7686; }
.centre { text-align: center; }
.carte { background: #fff; border-radius: 12px; padding: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: 12px; }
h1 { font-size: 20px; margin: 4px 0 10px; }
h2 { font-size: 17px; margin: 4px 0 8px; }
input, button, textarea { font: inherit; }
.champ { display: block; width: 100%; padding: 12px; margin: 6px 0 10px; border: 1px solid #c7cfda; border-radius: 10px; background: #fff; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 14px; border: 1px solid #c7cfda;
  border-radius: 10px; background: #fff; cursor: pointer; min-height: 46px; touch-action: manipulation; user-select: none; }
.btn:active { transform: translateY(1px); background: #eef2f7; }
.btn.prim { background: #1f6feb; border-color: #1f6feb; color: #fff; font-weight: 600; }
.btn.prim:active { background: #1a5fd0; }
.btn.large { width: 100%; font-size: 18px; }
.onglets { display: flex; gap: 6px; margin-bottom: 10px; }
.onglets .btn { flex: 1; }
.onglets .btn.on { background: #1f3a5f; color: #fff; border-color: #1f3a5f; }
.msg { padding: 10px; border-radius: 8px; margin: 8px 0; }
.msg.err { background: #fde8e8; color: #9b1c1c; }
.msg.ok { background: #e6f6ea; color: #1e6b33; }

/* travail */
.ligne { overflow-x: auto; border: 1px solid #dde3ea; border-radius: 8px; background: #fff; -webkit-overflow-scrolling: touch; }
.ligne img { display: block; height: 76px; width: auto; max-width: none; }
.syl { display: flex; justify-content: center; align-items: center; background: #fff; border: 1px solid #dde3ea; border-radius: 10px;
  margin: 6px 0; min-height: 100px; }
.syl img { max-width: 100%; max-height: 130px; image-rendering: auto; }
.prop { display: inline-block; margin: 2px 0; padding: 4px 10px; border-radius: 999px; background: #eef2f7; border: 1px dashed #9aa8bb;
  font-family: "Noto Naskh Arabic", "Amiri", "Scheherazade New", "Traditional Arabic", serif; font-size: 22px; cursor: pointer; direction: rtl; }
#txt { width: 100%; font-family: "Noto Naskh Arabic", "Amiri", "Scheherazade New", "Traditional Arabic", serif; font-size: 30px; line-height: 1.5;
  text-align: center; direction: rtl; padding: 6px 10px; border: 2px solid #1f6feb; border-radius: 12px; background: #fff; min-height: 54px; }
.actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 8px; }
.actions .prim { grid-column: 1 / -1; font-size: 19px; min-height: 52px; }
.actions .btn:not(.prim) { font-size: 14px; padding: 8px 4px; min-height: 42px; }
.barre { display: flex; justify-content: space-between; align-items: center; min-height: 34px; }
.lien.bleu { color: #1f6feb; }
.lien:disabled { color: #aab; text-decoration: none; }
.petit { font-size: 13px; }
.flash { animation: flash .35s; }
@keyframes flash { from { background: #e6f6ea; } to { background: transparent; } }

/* clavier arabe */
.clavier { margin-top: 8px; user-select: none; }
.clavier .rang { display: flex; gap: 4px; margin-bottom: 4px; direction: rtl; }
.clavier .t { flex: 1; min-width: 0; height: 40px; border: 1px solid #c7cfda; border-radius: 8px; background: #fff; cursor: pointer;
  font-family: "Noto Naskh Arabic", "Amiri", "Scheherazade New", "Traditional Arabic", serif; font-size: 22px; padding: 0; touch-action: manipulation; }
.clavier .t:active { background: #dbe7fb; }
.clavier .t.v { background: #f3f6fb; font-size: 24px; height: 46px; line-height: 1.1; }
.clavier .t.cmd { font-family: system-ui, sans-serif; font-size: 14px; flex: 1.6; direction: ltr; }
.clavier .lib { display: block; font-family: system-ui, sans-serif; font-size: 9px; color: #6b7686; line-height: 1; }

/* exemples */
.ex { display: grid; grid-template-columns: 1fr; gap: 10px; }
.ex .carte { display: flex; align-items: center; gap: 12px; margin: 0; }
.ex img { max-height: 70px; max-width: 55%; }
.ex .r { font-family: "Noto Naskh Arabic", "Amiri", "Scheherazade New", "Traditional Arabic", serif; font-size: 30px; direction: rtl; flex: 1; text-align: center; }
ul.regles { padding-left: 20px; margin: 6px 0; }
ul.regles li { margin: 4px 0; }
@media (min-width: 700px) {
  .ex { grid-template-columns: 1fr 1fr; }
  .ligne img { height: 120px; }
}
.langue { background: #1f3a5f; color: #fff; border: 1px solid #5b7aa3; border-radius: 6px; font-size: 13px; padding: 2px 4px; }

/* menu */
.menu-boite { position: relative; }
.menu-btn { background: none; border: 1px solid #5b7aa3; color: #fff; border-radius: 6px; font-size: 18px; padding: 0 9px; height: 30px; cursor: pointer; }
.menu-liste { position: absolute; right: 0; top: 36px; background: #fff; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.2); min-width: 230px; overflow: hidden; z-index: 20; }
.menu-liste button { display: block; width: 100%; text-align: left; padding: 13px 14px; border: 0; border-bottom: 1px solid #eef1f5; background: #fff; color: #1c2430; font-size: 15px; cursor: pointer; }
.menu-liste button:active, .menu-liste button:hover { background: #eef2f7; }
#bulle { position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 30px); opacity: 0; background: #1e6b33; color: #fff; padding: 10px 16px;
  border-radius: 999px; transition: .25s; z-index: 30; pointer-events: none; font-size: 15px; }
#bulle.err { background: #9b1c1c; }
#bulle.vu { opacity: 1; transform: translate(-50%, 0); }

/* accueil */
.bonjour { margin-top: 8px; }
.activite { display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; border: 2px solid transparent; cursor: pointer; font: inherit; color: inherit; }
.activite:active { border-color: #1f6feb; }
.activite:disabled { opacity: .55; cursor: default; }
.activite .txt { display: flex; flex-direction: column; gap: 2px; }
.activite b { font-size: 18px; }
.activite .dispo { color: #1e6b33; font-weight: 600; }
.ico { flex: 0 0 54px; height: 54px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 28px; }
.ico.texte { background: #e7f0ff; }
.ico.texte::before { content: "ب"; font-family: "Noto Naskh Arabic", "Amiri", serif; font-size: 32px; color: #1f3a5f; }
.ico.note { background: #fdf0e3; }
.ico.note::before { content: "♪"; color: #8a4b0f; }

/* commun aux deux activités */
.barre { display: flex; justify-content: space-between; align-items: center; min-height: 34px; gap: 6px; }
.nsp { margin: 4px 0 8px; }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ligne img { cursor: zoom-in; }
.ligne.grand img { height: 150px; cursor: zoom-out; }
.aide-touches { color: #6b7686; font-size: 12px; text-align: center; margin: 8px 0 0; }
kbd { display: inline-block; font: 11px/1 system-ui, sans-serif; border: 1px solid #c7cfda; border-bottom-width: 2px; border-radius: 4px; padding: 2px 4px; background: #f7f9fc; color: #44505f; margin-left: 4px; }

/* signes byzantins */
.duo { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; margin: 8px 0; }
.cadre-img { background: #fff; border: 1px solid #dde3ea; border-radius: 10px; display: flex; align-items: center; justify-content: center; min-height: 120px; overflow: hidden; }
.cadre-img img { max-width: 100%; max-height: 180px; }
.cadre-img.zoom img { max-height: 150px; }
.question { font-weight: 600; margin: 8px 0 6px; }
.tuiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tuile { position: relative; display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 6px 10px; border: 1px solid #c7cfda; border-radius: 12px;
  background: #fff; cursor: pointer; text-align: left; font-size: 14px; line-height: 1.2; touch-action: manipulation; color: inherit; }
.tuile img { width: 46px; height: 46px; object-fit: contain; flex: 0 0 46px; }
.tuile:active, .tuile.choisi { background: #dbe7fb; border-color: #1f6feb; }
.tuile.avant { border: 2px dashed #1f6feb; }
.tuile kbd { position: absolute; top: 4px; right: 6px; }
.tuiles.petites { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.tuiles.petites .tuile { min-height: 54px; }
.tuiles.petites .tuile img { width: 36px; height: 36px; flex-basis: 36px; }
.actions.trois { grid-template-columns: 1fr 1fr 1fr; }
.actions.trois .btn { font-size: 14px; padding: 8px 4px; min-height: 46px; }
#autreov { position: fixed; inset: 0; background: rgba(15,25,40,.45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.feuille { background: #f5f6f8; width: 100%; max-width: 760px; height: 88vh; border-radius: 16px 16px 0 0; display: flex; flex-direction: column; }
.feuille-haut { display: flex; gap: 8px; padding: 10px; align-items: center; }
.feuille-haut .champ { margin: 0; }
.liste { overflow-y: auto; padding: 0 10px 20px; -webkit-overflow-scrolling: touch; }
.liste h3 { font-size: 14px; color: #44505f; margin: 14px 0 6px; }
.ex .r.sig { display: flex; align-items: center; gap: 8px; font-family: inherit; font-size: 15px; direction: ltr; text-align: left; }
.ex .glyphe { width: 40px; height: 40px; object-fit: contain; }
button.prop { font: inherit; }
@media (min-width: 700px) {
  .tuiles { grid-template-columns: repeat(4, 1fr); }
  .tuile { flex-direction: column; text-align: center; min-height: 100px; justify-content: center; }
  .tuile img { width: 54px; height: 54px; flex-basis: auto; }
  .tuiles.petites .tuile { flex-direction: row; text-align: left; min-height: 54px; }
}
.glyphe-txt { flex: 0 0 46px; width: 46px; text-align: center; font-size: 26px; color: #44505f; font-family: "Noto Naskh Arabic", "Amiri", serif; }
.actions.deuxcol { grid-template-columns: 1fr 1fr; }
