/* محدد الصورة: الوجه فقط أو الشخصية كاملة */
.pp-backdrop { position: fixed; inset: 0; z-index: 2000; background: rgba(0, 12, 64, .62); display: grid; place-items: center; padding: 16px; backdrop-filter: blur(3px); }
.pp-backdrop[hidden] { display: none; }
body.pp-open { overflow: hidden; }
.pp-dialog {
  width: min(1100px, 100%); height: min(760px, calc(100vh - 32px)); background: #fff; border-radius: 18px; display: flex; flex-direction: column;
  box-shadow: 0 30px 80px -30px rgba(0, 12, 64, .7); overflow: hidden; font-family: "Cairo", system-ui, sans-serif; color: #000c40;
}
.pp-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid #e3e8f2; }
.pp-head h3 { margin: 0; font-size: 1.05rem; font-weight: 800; }
.pp-x { border: 0; background: #f1f4f9; width: 34px; height: 34px; border-radius: 50%; font-size: 22px; line-height: 1; color: #4a5578; }
.pp-x:hover { background: #e3e8f2; }
.pp-body { flex: 1; display: grid; grid-template-columns: 320px 1fr; min-height: 0; }
.pp-side { padding: 16px; border-inline-end: 1px solid #e3e8f2; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.pp-label { font-weight: 800; font-size: 13px; color: #4a5578; }
.pp-scopes { display: grid; gap: 8px; }
.pp-scopes button {
  display: grid; grid-template-columns: 38px 1fr; grid-template-rows: auto auto; column-gap: 10px; text-align: start; align-items: center;
  border: 1.5px solid #dfe5ef; background: #fff; border-radius: 14px; padding: 10px 12px; font-family: inherit; color: inherit;
}
.pp-scopes .pp-ico { grid-row: span 2; font-size: 26px; text-align: center; }
.pp-scopes b { font-size: 14.5px; }
.pp-scopes small { color: #6b7591; font-size: 12px; line-height: 1.5; }
.pp-scopes button.on { border-color: #01b9ff; background: #f0faff; box-shadow: 0 0 0 3px rgba(1, 185, 255, .15); }
.pp-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pp-tools button { border: 1.5px solid #dfe5ef; background: #f7f9fc; border-radius: 10px; padding: 7px 6px; font: 700 13px/1.4 "Cairo", sans-serif; color: #000c40; display: flex; gap: 6px; align-items: center; justify-content: center; }
.pp-tools button span { font-size: 15px; }
.pp-tools button.on { border-color: #000c40; background: #000c40; color: #fff; }
.pp-tools button[hidden] { display: none; }
.pp-msg { font-size: 12.5px; line-height: 1.7; min-height: 20px; border-radius: 10px; }
.pp-msg.ok { color: #0f7a45; background: #e9f8f0; padding: 6px 10px; }
.pp-msg.warn { color: #8a5a00; background: #fff4d6; padding: 6px 10px; }
.pp-result { display: grid; place-items: center; min-height: 170px; border-radius: 12px; background: repeating-conic-gradient(#eef2f8 0 25%, #fff 0 50%) 0 0 / 16px 16px; border: 1px solid #e3e8f2; }
.pp-result canvas { border-radius: 8px; box-shadow: 0 6px 16px -10px rgba(0, 12, 64, .5); }
.pp-stage { position: relative; display: grid; place-items: center; background: #1b2240; padding: 14px; min-height: 0; overflow: hidden; }
.pp-stage canvas { touch-action: none; border-radius: 6px; max-width: 100%; max-height: 100%; }
.pp-busy { position: absolute; inset: 0; display: flex; gap: 10px; align-items: center; justify-content: center; color: #fff; font-weight: 700; background: rgba(0, 12, 64, .45); }
.pp-busy[hidden] { display: none; }
.pp-spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: pp-spin .8s linear infinite; }
@keyframes pp-spin { to { transform: rotate(360deg); } }
.pp-foot { display: flex; justify-content: space-between; gap: 10px; padding: 12px 18px; border-top: 1px solid #e3e8f2; flex-wrap: wrap; }
.pp-btn { border-radius: 12px; padding: 9px 18px; font: 800 14px/1.4 "Cairo", sans-serif; border: 1.5px solid transparent; }
.pp-btn.primary { background: #000c40; color: #fff; }
.pp-btn.primary:hover { background: #10206b; }
.pp-btn.ghost { background: #fff; border-color: #dfe5ef; color: #000c40; }
.pp-btn:focus-visible, .pp-tools button:focus-visible, .pp-scopes button:focus-visible { outline: 2px solid #01b9ff; outline-offset: 2px; }
.pp-badge { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.pp-chip { background: #eaf7ff; color: #005b80; border-radius: 999px; padding: 3px 10px; font-size: 12.5px; font-weight: 700; }
.pp-reedit { border: 0; background: none; color: #0077b3; font: 700 12.5px "Cairo", sans-serif; text-decoration: underline; padding: 0; }
@media (max-width: 820px) {
  .pp-dialog { height: calc(100vh - 16px); }
  .pp-body { grid-template-columns: 1fr; grid-template-rows: minmax(260px, 1fr) auto; }
  .pp-stage { order: -1; }
  .pp-side { border-inline-end: 0; border-top: 1px solid #e3e8f2; max-height: 44vh; }
  .pp-result { min-height: 110px; }
}
.pp-link { border: 0; background: none; color: #0077b3; font: 700 12.5px "Cairo", sans-serif; text-decoration: underline; padding: 0; text-align: start; }
.pp-link[hidden] { display: none; }

/* اختيار أسلوب الرسم */
.style-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.style-pick .sp-input { position: absolute; opacity: 0; pointer-events: none; }
.style-pick .sp-card {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; border: 1.5px solid #dfe5ef; border-radius: 14px;
  padding: 12px 8px; cursor: pointer; background: #fff; transition: border-color .15s, box-shadow .15s, background .15s; height: 100%;
}
.style-pick .sp-card svg { width: 56px; height: 56px; margin-bottom: 4px; }
.style-pick .sp-card b { font-size: 14px; color: #000c40; }
.style-pick .sp-card small { color: #6b7591; font-size: 12px; line-height: 1.5; }
.style-pick .sp-input:checked + .sp-card { border-color: #01b9ff; background: #f0faff; box-shadow: 0 0 0 3px rgba(1, 185, 255, .16); }
.style-pick .sp-input:focus-visible + .sp-card { outline: 2px solid #01b9ff; outline-offset: 2px; }
@media (max-width: 560px) { .style-pick { grid-template-columns: 1fr; } .style-pick .sp-card { flex-direction: row; text-align: start; gap: 10px; } .style-pick .sp-card svg { flex: none; width: 44px; height: 44px; margin: 0; } .style-pick .sp-card b { min-width: 110px; } }
