:root { --bg:#F6F7FB; --card:#fff; --ink:#1F2430; --muted:#7A8296; --blue:#1F6FEB; --line:#E6E9F0; }
* { box-sizing:border-box; margin:0; padding:0; -webkit-tap-highlight-color:transparent; }
html, body { height:100%; }
body { background:var(--bg); color:var(--ink); direction:rtl; touch-action:manipulation; -webkit-user-select:none; user-select:none;
  font-family:'Noto Sans Arabic','Noto Naskh Arabic',system-ui,sans-serif; overflow:hidden; }
.screen { height:100dvh; display:flex; flex-direction:column; gap:12px;
  padding:calc(16px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right))
          calc(16px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left)); }
.top { display:flex; align-items:center; justify-content:space-between; }
.top.leveltop { padding-left:46px; }
.title { font-size:20px; font-weight:700; }
.sub { font-size:12px; color:var(--muted); }
.card { background:var(--card); border-radius:18px; padding:14px; box-shadow:0 1px 3px rgba(20,25,40,.07); }
.btn { border:0; border-radius:16px; padding:14px; font:inherit; font-weight:600; background:var(--blue); color:#fff; }
.btn.ghost { background:#fff; color:var(--blue); border:1px solid #D8E2F5; }
.levels { display:flex; flex-direction:column; gap:12px; }
.levelbtn { width:100%; border:0; font:inherit; color:inherit; display:flex; align-items:center; justify-content:space-between; gap:12px; text-align:right; }
.levelbtn .n { width:34px; height:34px; border-radius:12px; background:#E8F3FF; color:var(--blue);
  display:grid; place-items:center; font-weight:700; }
.stage { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:16px; }
.big { width:min(78vw,320px); aspect-ratio:1; display:grid; place-items:center; }
.big img { width:100%; height:100%; object-fit:contain; border-radius:26px;
  box-shadow:0 8px 24px rgba(25,35,60,.10); }
.word { font-size:42px; font-weight:700; }
.speaker { width:56px; height:56px; border-radius:50%; border:0; background:var(--blue); color:#fff; font-size:22px; }
.speaker[hidden] { display:none; }
.choices { display:grid; grid-template-columns:1fr 1fr; gap:12px; width:100%; max-width:420px; }
.choices.c1 { grid-template-columns:1fr; max-width:260px; }
.choices.c3 { grid-template-columns:repeat(3,1fr); gap:8px; max-width:520px; }
.choices.c4 { grid-template-columns:1fr 1fr; }
.choice { border:2px solid transparent; border-radius:24px; padding:0; overflow:hidden; background:#fff; aspect-ratio:1; }
.choice img { width:100%; height:100%; object-fit:contain; }
.choice.right { border-color:#34C759; }
.choice.wrong { animation:shake .3s; }
@keyframes shake { 25%{transform:translateX(4px)} 75%{transform:translateX(-4px)} }
.dots { display:flex; gap:6px; justify-content:center; }
.dot { width:7px; height:7px; border-radius:50%; background:#D5DBE7; }
.dot.on { background:var(--blue); }
.gear { position:fixed; top:calc(12px + env(safe-area-inset-top)); left:calc(12px + env(safe-area-inset-left)); width:34px; height:34px; border-radius:50%; border:0;
  background:rgba(255,255,255,.8); color:#9AA3B5; font-size:16px; }
.foot { display:flex; gap:10px; }
.foot .btn { flex:1; }
.badge { font-size:11px; padding:3px 9px; border-radius:20px; background:#EEF1F7; color:#5A6274; }
.pin { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; width:100%; max-width:300px; margin:0 auto; }
.pin button { font:inherit; font-size:20px; padding:16px 0; border-radius:16px; border:1px solid var(--line); background:#fff; }
.pinout { display:flex; gap:10px; justify-content:center; }
.pinout i { width:12px; height:12px; border-radius:50%; background:#D5DBE7; display:block; }
.pinout i.on { background:var(--blue); }
.list { display:flex; flex-direction:column; gap:10px; }
.rowline { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.hint { font-size:12px; color:#8A6D3B; background:#FFF6E6; border-radius:12px; padding:10px; }

/* child selector */
.kids { display:flex; gap:8px; }
.kid { flex:1; padding:10px 8px; border-radius:14px; border:1.5px solid #dfe3ee;
  background:#fff; font:inherit; font-size:15px; color:#2a3350; }
.kid.on { background:#2f6df6; border-color:#2f6df6; color:#fff; font-weight:600; }
.best { color:#2f6df6; font-size:12px; margin-top:2px; }

/* ---- panel editors ---- */
.phead { display:flex; align-items:center; gap:10px; flex-wrap:nowrap; }
.phead > div { min-width:0; }
.phead .title { font-size:18px; }
.prow { display:flex; align-items:center; gap:10px; padding:10px 12px; border-bottom:1px solid #eef1f7; }
.prow:last-child { border-bottom:none; }
.prow .thumb { width:44px; height:44px; border-radius:10px; object-fit:cover; background:#f1f4fa; flex:none; }
.prow .grow { flex:1; min-width:0; }
.prow .name { font-size:15px; color:#2a3350; }
.prow .meta { font-size:12px; color:#7b849b; }
.chev { color:#b9c1d4; font-size:18px; }
.card.pad0 { padding:0; overflow:hidden; }
.card .cardhead { padding:12px; font-size:13px; color:#7b849b; background:#f8faff; }
.field { padding:10px 12px; display:flex; flex-direction:column; gap:6px; border-bottom:1px solid #eef1f7; }
.field label { font-size:13px; color:#7b849b; }
.field input[type=text], .field input[type=number], .field select {
  font:inherit; font-size:15px; padding:10px 12px; border-radius:12px;
  border:1.5px solid #dfe3ee; background:#fff; color:#2a3350; width:100%; }
.field input:focus, .field select:focus { outline:none; border-color:#2f6df6; }
.thumbs { display:flex; flex-wrap:wrap; gap:8px; padding:12px; }
.thumbwrap { position:relative; width:84px; height:84px; border-radius:14px; overflow:hidden; background:#f1f4fa; }
.thumbwrap img { width:100%; height:100%; object-fit:cover; }
.thumbwrap .del { position:absolute; top:4px; inset-inline-end:4px; width:24px; height:24px;
  border-radius:12px; border:none; background:rgba(20,26,44,.66); color:#fff; font-size:14px; line-height:1; }
.thumbwrap .tag { position:absolute; bottom:0; left:0; right:0; font-size:10px; padding:2px 4px;
  background:rgba(20,26,44,.55); color:#fff; text-align:center; }
.addtile { width:84px; height:84px; border-radius:14px; border:1.5px dashed #c3cce0; background:#fff;
  color:#2f6df6; font-size:24px; }
.btn.danger { background:#e5484d; border-color:#e5484d; color:#fff; }
.btn.small { padding:10px 12px; font-size:14px; min-height:44px; min-width:44px; }
.toggle { width:54px; height:34px; border-radius:17px; border:1px solid #c9d0e0; background:#d7dcea; border:none; position:relative; flex:none; }
.toggle.on { background:#2f6df6; }
.toggle i { position:absolute; top:3px; inset-inline-start:3px; width:26px; height:26px; border-radius:13px; box-shadow:0 1px 2px rgba(0,0,0,.15);
  background:#fff; transition:inset-inline-start .15s; }
.toggle.on i { inset-inline-start:23px; }
.toggle.on { border-color:#2f6df6; }
.modal { position:fixed; inset:0; background:rgba(16,22,38,.45); display:flex; align-items:center;
  justify-content:center; padding:20px; z-index:50; }
.modal .sheet { background:#fff; border-radius:20px; padding:16px; width:100%; max-width:340px; display:flex;
  flex-direction:column; gap:14px; }
.modal .foot { display:flex; gap:8px; }
.modal .foot .btn { flex:1; }
.checkrow { display:flex; align-items:center; gap:10px; padding:10px 12px; border-bottom:1px solid #eef1f7; }
.checkrow input { width:20px; height:20px; accent-color:#2f6df6; }
.savebar { display:flex; gap:8px; padding:12px 0; }
.savebar .btn { flex:1; }

/* section chips + child-safe touches */
.chips { display:flex; gap:8px; overflow-x:auto; padding-bottom:2px; }
.chip { flex:none; padding:10px 14px; min-height:44px; border-radius:14px; border:1.5px solid #dfe3ee;
  background:#fff; font:inherit; font-size:14px; color:#2a3350; }
.chip.on { background:#2f6df6; border-color:#2f6df6; color:#fff; font-weight:600; }
.star { display:block; }
.stage img, .choice img { -webkit-user-drag:none; }
.prow .toggle, .prow .btn.small { flex:none; }
