@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@400;600;700;800;900&display=swap');

:root{
  font-family:'Noto Sans Arabic',Tahoma,Arial,sans-serif;
  color:#17324d;
  background:#eef5fb;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0;
  min-height:100vh;
  background:
    radial-gradient(circle at 12% 10%,rgba(113,188,255,.25),transparent 28%),
    radial-gradient(circle at 88% 18%,rgba(255,158,202,.22),transparent 28%),
    linear-gradient(145deg,#f6fbff 0%,#eef3fa 55%,#faf5fb 100%);
}
button,input{font:inherit}
.app{width:min(1060px,94vw);margin:0 auto;padding:30px 0 54px}
.screen{display:none;min-height:calc(100vh - 84px);align-items:center;justify-content:center;flex-direction:column}
.screen.active{display:flex}

.hero{text-align:center;margin-bottom:30px}
.hero .spark{font-size:28px;letter-spacing:12px}
.hero h1{font-size:clamp(42px,7vw,74px);line-height:1.1;margin:10px 0 8px;font-weight:900;letter-spacing:-2px;color:#19324e}
.hero p,.result-head p{color:#6e7887;font-size:17px;margin:0}
.gender-grid{display:grid;grid-template-columns:repeat(2,minmax(220px,360px));gap:24px;width:100%;justify-content:center}
.gender-card{
  position:relative;border:0;border-radius:34px;padding:30px 24px 28px;cursor:pointer;
  display:flex;flex-direction:column;align-items:center;gap:4px;
  transition:transform .2s ease,box-shadow .2s ease;
  box-shadow:0 16px 45px rgba(33,62,98,.12);
  overflow:hidden;
}
.gender-card:before{content:"";position:absolute;inset:10px;border:2px dashed rgba(255,255,255,.7);border-radius:28px;pointer-events:none}
.gender-card:hover{transform:translateY(-6px) rotate(-.4deg);box-shadow:0 24px 56px rgba(33,62,98,.16)}
.gender-card .emoji{font-size:82px;filter:drop-shadow(0 8px 8px rgba(0,0,0,.08))}
.gender-card strong{font-size:34px;font-weight:900}
.gender-card small{font-size:15px;opacity:.8}
.boy{background:linear-gradient(145deg,#d8efff,#afd8ff);color:#125895}
.girl{background:linear-gradient(145deg,#ffe4ef,#f9c8dd);color:#b73c70}

.back{
  border:0;background:rgba(255,255,255,.72);color:#526173;cursor:pointer;
  align-self:flex-start;margin-bottom:13px;padding:9px 14px;border-radius:12px;
  box-shadow:0 6px 18px rgba(40,57,80,.07)
}
.hero.compact{margin-bottom:22px}
.selected-badge{
  display:inline-flex;align-items:center;padding:7px 16px;border-radius:999px;
  background:#fff;box-shadow:0 5px 18px rgba(0,0,0,.08);font-size:14px
}
.dropzone{
  width:min(690px,100%);min-height:330px;border:3px dashed #b9c8d8;border-radius:30px;
  background:rgba(255,255,255,.92);display:flex;align-items:center;justify-content:center;
  cursor:pointer;overflow:hidden;box-shadow:0 16px 45px rgba(33,62,98,.09);transition:.2s
}
.dropzone.drag{border-color:#3c8ccc;background:#f2f9ff;transform:scale(1.01)}
.dropzone input{display:none}
.dropzone>div{display:flex;flex-direction:column;align-items:center;gap:10px;padding:42px}
.upload-icon{
  width:72px;height:72px;border-radius:22px;display:grid;place-items:center;
  background:linear-gradient(145deg,#eaf4ff,#dcecff);color:#1f75b7;font-size:34px;font-weight:900
}
.dropzone strong{font-size:22px}
.dropzone span{font-size:13px;color:#838d9b}
.dropzone img{display:none;max-width:100%;max-height:410px;object-fit:contain}
.dropzone.has-image #uploadEmpty{display:none}
.dropzone.has-image img{display:block}

.actions{display:flex;gap:12px;justify-content:center;margin-top:20px;flex-wrap:wrap}
.primary,.secondary{
  border:0;border-radius:15px;padding:14px 26px;font:inherit;font-weight:800;cursor:pointer
}
.primary{background:#1769aa;color:#fff;box-shadow:0 10px 24px rgba(23,105,170,.23)}
.primary:disabled{opacity:.45;cursor:not-allowed}
.secondary{background:#fff;color:#304156;border:1px solid #dbe3ea}
.privacy{font-size:12px;color:#8b95a3;margin-top:15px}

.result-head{width:100%;display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:20px;gap:20px}
.result-head h1{margin:0;font-size:34px}
.result-head .back{order:2}
.sheet-wrap{
  background:linear-gradient(135deg,#d7dde5,#edf0f4);padding:18px;border-radius:20px;
  max-height:75vh;overflow:auto;box-shadow:0 18px 48px rgba(29,50,74,.15)
}
.sheet-wrap canvas{display:block;width:min(760px,80vw);height:auto;background:#fff;box-shadow:0 7px 22px rgba(0,0,0,.14)}
.result-actions{margin-top:18px}

@media(max-width:600px){
  .app{width:92vw}
  .gender-grid{grid-template-columns:1fr}
  .result-head{flex-direction:column;gap:8px}
  .result-head .back{order:0}
  .result-head h1{font-size:26px}
  .sheet-wrap{padding:8px}
  .sheet-wrap canvas{width:92vw}
}