*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
:root{--g:#58cc02;--gd:#58a700;--b:#1cb0f6;--bd:#1899d6;--o:#ff9600;--r:#ff4b4b;--rd:#ea2b2b;--bg:#fff;--ink:#3c3c3c;--mut:#777;--line:#e5e5e5;--soft:#f7f7f7}
html,body{margin:0;background:var(--bg);color:var(--ink);font-family:"Segoe UI",Tahoma,"Noto Naskh Arabic","Noto Sans Arabic",Arial,sans-serif;line-height:1.6;min-height:100%}
body{padding-bottom:env(safe-area-inset-bottom)}
button{font-family:inherit;font-size:1rem;cursor:pointer}
#app{max-width:560px;margin:0 auto;min-height:100vh;display:flex;flex-direction:column}
.top{position:sticky;top:0;z-index:5;background:#fff;border-bottom:2px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:10px 14px;gap:8px}
.logo{font-weight:800;color:var(--g);font-size:1.4rem;letter-spacing:.5px;direction:ltr}
.stats{display:flex;gap:12px;font-weight:700}
.stat{display:flex;align-items:center;gap:4px}
.install{background:var(--b);color:#fff;border:0;border-bottom:4px solid var(--bd);border-radius:12px;padding:6px 12px;font-weight:700}
.path{padding:12px 16px 24px;flex:1}
.unit{border-radius:16px;color:#fff;padding:12px 16px;margin:18px 0 8px}
.unit h2{margin:0;font-size:1.15rem}.unit p{margin:0;opacity:.92;font-size:.9rem}
.nodes{display:flex;flex-direction:column;align-items:center;gap:14px;padding:10px 0}
.node{width:78px;height:72px;border-radius:50%;border:0;color:#fff;font-size:1.9rem;position:relative;display:flex;align-items:center;justify-content:center;border-bottom:7px solid rgba(0,0,0,.22);transition:transform .1s}
.node:active{transform:translateY(4px);border-bottom-width:3px}
.node.locked{background:#e5e5e5!important;color:#afafaf;border-bottom-color:#c4c4c4;cursor:not-allowed}
.node.done::after{content:"✓";position:absolute;top:-4px;inset-inline-end:-4px;background:#ffc800;color:#fff;border-radius:50%;width:24px;height:24px;font-size:.9rem;line-height:24px;font-weight:800;border:2px solid #fff}
.node.current{animation:pulse 1.6s infinite}
@keyframes pulse{0%,100%{box-shadow:0 0 0 0 rgba(88,204,2,.45)}50%{box-shadow:0 0 0 12px rgba(88,204,2,0)}}
.nlabel{font-size:.85rem;font-weight:700;color:var(--mut);text-align:center;margin-top:-6px;max-width:200px}
.stars{font-size:.8rem;letter-spacing:2px;color:#ffc800;height:1em;margin-top:-4px}
.foot{text-align:center;color:var(--mut);font-size:.85rem;padding:18px 12px 28px;border-top:2px solid var(--line)}
.foot b{color:var(--ink)}
.screen{display:flex;flex-direction:column;flex:1;padding:14px 16px}
.bar{display:flex;align-items:center;gap:12px;margin-bottom:14px}
.x{background:none;border:0;font-size:1.6rem;color:#afafaf;padding:0 4px}
.prog{flex:1;height:16px;border-radius:10px;background:var(--line);overflow:hidden}
.prog>i{display:block;height:100%;background:var(--g);border-radius:10px;transition:width .3s;width:0}
.card{background:#fff;border:2px solid var(--line);border-radius:16px;padding:16px;margin-bottom:12px;font-size:1.08rem}
.card p{margin:0 0 8px}
pre,code,.mono{font-family:"SFMono-Regular",Consolas,"DejaVu Sans Mono","Courier New",monospace;direction:ltr;unicode-bidi:isolate}
code{background:#eef2f6;border-radius:6px;padding:1px 6px;font-size:.95em;display:inline-block}
pre{background:#1f2430;color:#e8eef8;border-radius:12px;padding:12px 14px;margin:8px 0;overflow-x:auto;text-align:left;font-size:.98rem;line-height:1.55;white-space:pre}
pre.out{background:#f1f3f6;color:#222;border:2px dashed #cdd3dc;margin-top:4px}
.outl{font-size:.8rem;color:var(--mut);margin-top:6px}
.note{font-size:.85rem;color:var(--mut)}
.q{font-size:1.25rem;font-weight:800;margin:6px 0 10px;white-space:pre-line}
.opts{display:flex;flex-direction:column;gap:10px;margin-top:8px}
.opt{background:#fff;border:2px solid var(--line);border-bottom-width:5px;border-radius:14px;padding:12px 14px;text-align:start;color:var(--ink);font-weight:600}
.opt.mono{direction:ltr;text-align:left;font-family:"SFMono-Regular",Consolas,"DejaVu Sans Mono","Courier New",monospace;white-space:pre;unicode-bidi:isolate}
.opt.sel{border-color:var(--b);background:#ddf4ff;color:var(--bd)}
.opt.ok{border-color:var(--g);background:#d7ffb8;color:var(--gd)}
.opt.no{border-color:var(--r);background:#ffdfe0;color:var(--rd)}
.opt[disabled]{cursor:default}
.slot{display:inline-block;min-width:72px;min-height:1.6em;border-bottom:3px dashed #8aa;background:#2e3646;border-radius:6px;padding:0 8px;margin:0 2px;color:#fff;vertical-align:baseline;text-align:center}
.slot.f{border-bottom:3px solid var(--b);background:#2f6a8c}
.bank,.pool,.answer{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.chip{background:#fff;border:2px solid var(--line);border-bottom-width:5px;border-radius:12px;padding:8px 12px;direction:ltr;font-family:"SFMono-Regular",Consolas,"DejaVu Sans Mono",monospace;color:var(--ink);white-space:pre;text-align:left}
.chip.used{opacity:.25;pointer-events:none}
.answer{min-height:74px;border:2px dashed #cdd3dc;border-radius:14px;padding:10px;flex-direction:column;flex-wrap:nowrap;background:var(--soft)}
.answer .chip{width:100%}
.answer:empty::before{content:"دوس على الأسطر بالترتيب هنا";color:#aaa;font-size:.9rem}
.spacer{flex:1}
.cta{margin-top:14px;width:100%;border:0;border-bottom:5px solid var(--gd);background:var(--g);color:#fff;border-radius:16px;padding:14px;font-weight:800;font-size:1.1rem;letter-spacing:.3px}
.cta:active{transform:translateY(3px);border-bottom-width:2px}
.cta[disabled]{background:#e5e5e5;border-bottom-color:#c4c4c4;color:#afafaf;cursor:not-allowed}
.cta.red{background:var(--r);border-bottom-color:var(--rd)}
.cta.ghost{background:#fff;color:var(--b);border:2px solid var(--line);border-bottom-width:5px}
.fb{margin:14px -16px -14px;padding:14px 16px 18px;border-radius:18px 18px 0 0}
.fb.ok{background:#d7ffb8;color:var(--gd)}.fb.no{background:#ffdfe0;color:var(--rd)}
.fb h3{margin:0 0 4px;font-size:1.2rem}.fb p{margin:0 0 4px;color:inherit;white-space:pre-line}
.fb pre{background:rgba(255,255,255,.7);color:#222;margin:6px 0}
.center{text-align:center}.big{font-size:4rem;margin:10px 0 0}
.res{display:flex;gap:10px;justify-content:center;margin:16px 0}
.rbox{border:2px solid var(--line);border-radius:14px;padding:10px 16px;min-width:96px}
.rbox b{display:block;font-size:1.4rem}
.toast{position:fixed;bottom:18px;left:50%;transform:translateX(-50%);background:#333;color:#fff;padding:10px 16px;border-radius:12px;z-index:20;max-width:90%;text-align:center}
.hint{background:#fff7d6;border:2px solid #ffd966;border-radius:12px;padding:10px 12px;margin:10px 0;font-size:.92rem}
.link{background:none;border:0;color:var(--b);text-decoration:underline;padding:0}
.warn{color:var(--mut);font-size:.8rem}

.editor{width:100%;background:#1f2430;color:#e8eef8;border:2px solid #343c4f;border-radius:12px;padding:10px 12px;font-family:"SFMono-Regular",Consolas,"DejaVu Sans Mono","Courier New",monospace;font-size:16px;line-height:1.5;direction:ltr;text-align:left;tab-size:4;white-space:pre;overflow:auto;resize:vertical;margin-top:6px}
.editor:focus{outline:none;border-color:var(--b)}
.editor.small{background:#f1f3f6;color:#222;border-color:#cdd3dc}
.editor[readonly]{opacity:.8}
.symbar{display:flex;gap:6px;overflow-x:auto;margin:6px 0;direction:ltr;padding-bottom:2px}
.sym{flex:0 0 auto;min-width:40px;height:38px;border:2px solid var(--line);border-bottom-width:4px;border-radius:10px;background:#fff;font-family:"SFMono-Regular",Consolas,monospace;font-size:1.05rem;color:var(--ink)}
.two{display:flex;gap:10px}.two .cta{margin-top:10px}
.linkrow{display:flex;justify-content:center;gap:18px;margin-top:10px}
.fb.inline{margin:10px 0;border-radius:14px}
.fb.inline .mono{font-weight:700}
