*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
:root{--ease:cubic-bezier(.2,.8,.2,1);--sans:"Inter",system-ui,-apple-system,sans-serif;--MH:min(78vh,62vw)}
@media(max-width:767px){:root{--MH:min(46vh,100vw)}}
body{background:#e9e4dc;color:#fff;font-family:var(--sans);overflow:hidden;-webkit-font-smoothing:antialiased;user-select:none}
button{font:inherit;color:inherit;background:none;border:0}
@media(pointer:fine){html,body,button{cursor:none}}
/* loading veil — plain, covers everything until the 3 scene sheets load */
#veil{position:fixed;inset:0;z-index:200;background:#e9e4dc;display:flex;align-items:center;justify-content:center;transition:opacity .5s var(--ease)}
#veil.done{opacity:0;pointer-events:none}
.veil-inner{display:flex;flex-direction:column;align-items:center;gap:14px;color:#14161c}
.veil-inner strong{font-size:28px;font-weight:800;letter-spacing:-.02em}
.veil-inner span:last-child{font-size:13px;opacity:.6}
.veil-spin{width:28px;height:28px;border:3px solid rgba(20,22,28,.15);border-top-color:#14161c;border-radius:50%;animation:spin 1s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
#room{position:fixed;inset:-3%;background-image:var(--room);background-size:cover;background-position:center;filter:blur(2.5px) saturate(1.05);transform:scale(1.08)}
#room::after{content:"";position:absolute;inset:0;background:radial-gradient(70% 60% at 50% 45%,rgba(255,252,246,.10),rgba(40,30,20,.16))}
#ghost{position:fixed;left:50%;top:calc(50% - var(--MH)*.42);transform:translateX(-50%);z-index:2;font-weight:900;font-size:calc(var(--MH)*.42);line-height:.8;letter-spacing:-.04em;color:rgba(255,255,255,.3);-webkit-text-stroke:1px rgba(255,255,255,.35);text-shadow:0 1px 0 rgba(255,255,255,.35);pointer-events:none;white-space:nowrap}
#ghost span{display:inline-block;will-change:transform}
.glass{background:linear-gradient(155deg,rgba(250,248,245,.30),rgba(150,144,136,.20) 48%,rgba(205,200,192,.24));backdrop-filter:blur(22px) saturate(1.5);-webkit-backdrop-filter:blur(22px) saturate(1.5);border:1px solid rgba(255,255,255,.5);box-shadow:inset 0 1px 0 rgba(255,255,255,.7),inset 0 -1px 0 rgba(255,255,255,.12),0 20px 50px -24px rgba(40,30,20,.45)}
#topbar{position:fixed;top:14px;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:10px;padding:10px 18px;z-index:30;max-width:94vw;border-radius:999px}
.logoimg{height:26px;border-radius:8px}.brand{font-size:18px;letter-spacing:-.02em;color:#14161c;white-space:nowrap}.tag{opacity:.65;font-size:13px;color:#14161c}.sp{flex:1;min-width:12px}
.langbtn{color:#14161c;text-decoration:none;font-weight:600;font-size:13px;padding:6px 12px;border-radius:999px;background:rgba(255,255,255,.6);white-space:nowrap}
#tabs{position:fixed;top:76px;left:50%;transform:translateX(-50%);display:flex;gap:2px;padding:5px;z-index:30;border-radius:999px;max-width:96vw}
#tabs .pill{position:absolute;top:5px;bottom:5px;left:5px;width:0;background:rgba(255,255,255,.92);border-radius:999px;box-shadow:0 4px 14px -6px rgba(0,0,0,.3);transition:transform .6s var(--ease),width .6s var(--ease);z-index:0}
#tabs button{position:relative;z-index:1;height:38px;padding:0 22px;border-radius:999px;font-weight:500;font-size:14px;cursor:pointer;white-space:nowrap;color:rgba(30,30,32,.72)}
#tabs button.on{color:#111}
#stage{position:fixed;inset:0;z-index:10;touch-action:pan-y}
/* single-layer figure: exact 524/1360 model ratio, bottom-anchored, head to mid-thigh */
#figure{position:absolute;left:50%;bottom:0;transform:translateX(-50%);height:var(--MH);aspect-ratio:524/1360;z-index:50;pointer-events:none}
#mCur,#mNext{position:absolute;inset:0;background-repeat:no-repeat;background-size:513% 111.76%;background-position-y:100%}
#mNext{clip-path:inset(0 0 100% 0)}
#mCur.hidden{visibility:hidden}
#figure .grid{position:absolute;inset:0;background:repeating-linear-gradient(0deg,transparent 0 5px,rgba(255,255,255,.22) 5px 6px);clip-path:inset(0 0 100% 0);pointer-events:none}
#scan{position:absolute;left:-14%;width:128%;height:2px;top:0;background:linear-gradient(90deg,transparent,#fff 18%,#fff 82%,transparent);box-shadow:0 0 18px 4px rgba(255,255,255,.75),0 0 60px 10px rgba(190,225,255,.45);opacity:0;border-radius:2px}
#scan::after{content:"";position:absolute;left:0;right:0;bottom:2px;height:calc(var(--MH)*.12);background:linear-gradient(to top,rgba(220,238,255,.32),transparent)}
/* arc origin at chest height: 46% desktop, 44% mobile — no card over the head */
#arc{position:absolute;left:50%;top:46%;width:0;height:0;pointer-events:none}
.card{position:absolute;left:0;top:0;width:var(--CW);height:calc(var(--CW)*1.42);margin-left:calc(var(--CW)/-2);margin-top:calc(var(--CW)*-.71);border-radius:22px;overflow:hidden;pointer-events:auto;will-change:transform,opacity}
.card.on{box-shadow:inset 0 1px 0 rgba(255,255,255,.7),inset 0 -1px 0 rgba(255,255,255,.12),0 0 0 2px rgba(20,22,28,.85),0 20px 50px -24px rgba(40,30,20,.45)}
.card .g{position:absolute;left:8%;right:8%;top:5%;aspect-ratio:1/1;background-repeat:no-repeat;filter:drop-shadow(0 14px 14px rgba(40,30,20,.22))}
.card .nm{position:absolute;left:0;right:0;bottom:17%;text-align:center;font-weight:500;font-size:calc(var(--CW)*.068);color:#fff;text-shadow:0 1px 8px rgba(0,0,0,.18);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:0 6px}
.card .pr{position:absolute;left:0;right:0;bottom:7%;text-align:center;font-weight:700;font-size:calc(var(--CW)*.095);color:#fff;text-shadow:0 1px 8px rgba(0,0,0,.18)}
.card .sheen{position:absolute;inset:0;background:linear-gradient(105deg,transparent 40%,rgba(255,255,255,.5) 50%,transparent 60%);opacity:0;pointer-events:none}
.card:hover .sheen{animation:sheen 1s var(--ease)}
@keyframes sheen{0%{opacity:0;transform:translateX(-100%)}25%{opacity:1}75%{opacity:1}100%{opacity:0;transform:translateX(100%)}}
/* buy card — narrow/compact, single row on desktop, never widened */
#buy{position:fixed;bottom:4.6vh;left:50%;transform:translateX(-50%);z-index:60;display:flex;gap:22px;align-items:center;padding:12px 22px 12px 12px;width:min(680px,calc(100vw - 32px));border-radius:24px;color:#fff;text-shadow:0 1px 6px rgba(0,0,0,.18)}
#buyThumb{width:64px;height:64px;flex:none;border-radius:14px;background-color:rgba(255,255,255,.3);background-repeat:no-repeat;background-position:center}
#buyInfo{flex:1;min-width:0;display:flex;flex-direction:column}
#buyMeta{min-width:0}
#buyRow2{display:flex;gap:16px;align-items:flex-end;justify-content:space-between}
#buyRow3{display:flex;gap:16px;align-items:flex-end;justify-content:space-between}
.buyCol{min-width:0}
#qtyCol{display:none}
#qtyWrap{display:flex;gap:6px;align-items:center}
#qtyWrap button{width:28px;height:28px;border-radius:50%;background:rgba(255,255,255,.22);color:#fff;font-weight:700;font-size:14px;cursor:pointer}
#qtyWrap button:active{transform:scale(.9)}
#qtyVal{min-width:20px;text-align:center;font-weight:700;font-size:14px}
#buyName{font-weight:600;font-size:16px}
#buyPrice{font-weight:500;font-size:14px;opacity:.9}
.ln{height:1.15em;overflow:hidden;position:relative}
.ln span{display:block}
.lbl{font-weight:500;font-size:12px;opacity:.85;margin-top:4px}
#sizes,#colors{display:flex;gap:6px;margin:4px 0 6px;flex-wrap:wrap}
#sizes button{width:30px;height:30px;border-radius:50%;border:0;background:rgba(255,255,255,.22);color:#fff;font-weight:700;font-size:12px;cursor:pointer}
#sizes button.on{background:#fff;color:#111}
#sizes button:active{transform:scale(.9)}
#colors button{width:18px;height:18px;border-radius:50%;border:0;cursor:pointer}
#colors button.on{box-shadow:0 0 0 2px rgba(255,255,255,.95),0 0 0 4px rgba(0,0,0,.12)}
#buyBtn{flex:none;background:#14161c;color:#fff;border:0;border-radius:999px;padding:0 26px;height:44px;font-weight:800;font-size:15px;cursor:pointer;white-space:nowrap;text-shadow:none}
#prevBtn,#nextBtn{position:absolute;top:50%;transform:translateY(-50%);z-index:20;width:46px;height:46px;border-radius:50%;border:1px solid rgba(255,255,255,.6);background:rgba(255,255,255,.55);backdrop-filter:blur(16px);font-size:16px;line-height:1;color:#222;cursor:pointer;box-shadow:0 10px 26px rgba(25,35,60,.2)}
#prevBtn{left:calc(max(18px,1.8vw) + 76px)}#nextBtn{right:max(18px,1.8vw)}
#rail{position:fixed;left:max(18px,1.8vw);top:50%;transform:translateY(-50%);z-index:30;display:flex;flex-direction:column;gap:10px;padding:8px;border-radius:999px}
#rail button{width:42px;height:42px;border-radius:50%;border:0;background:transparent;font-size:20px;cursor:pointer;color:rgba(30,30,32,.8)}
#rail button.on{background:rgba(255,255,255,.9);color:#111}
#rail button:hover{background:rgba(255,255,255,.35)}
#cursor{position:fixed;width:58px;height:58px;border-radius:50%;background:rgba(255,255,255,.14);border:1.5px solid rgba(255,255,255,.95);backdrop-filter:blur(6px);pointer-events:none;z-index:99;transform:translate(-50%,-50%);transition:width .5s var(--ease),height .5s var(--ease),background .5s var(--ease);display:flex;align-items:center;justify-content:center;box-shadow:0 6px 20px -8px rgba(0,0,0,.35)}
#cursor .cdot{position:absolute;width:6px;height:6px;border-radius:50%;background:#fff;transition:opacity .4s var(--ease)}
#cursor #curTxt{position:relative;font-size:10px;font-weight:700;letter-spacing:.12em;color:#111;opacity:0;transition:opacity .45s var(--ease)}
#cursor.try{width:87px;height:87px;background:rgba(255,255,255,.92)}
#cursor.try #curTxt{opacity:1}
#cursor.try .cdot{opacity:0}
#cursor.drag{width:70px;height:70px}
#cursor.drag #curTxt{color:#fff;text-shadow:0 1px 6px rgba(0,0,0,.4);opacity:1}
#cursor.drag .cdot{opacity:0}
#cursor.btn{width:35px;height:35px}
#cursor.btn #curTxt{display:none}
#cursor.down{transform:translate(-50%,-50%) scale(1.05)}
@media(pointer:coarse){#cursor{display:none}}
#modal{position:fixed;inset:0;background:rgba(30,36,52,.35);backdrop-filter:blur(8px);z-index:120;display:flex;align-items:center;justify-content:center;padding:14px}
#modal[hidden]{display:none}
.sheet{max-width:440px;width:100%;max-height:92vh;overflow:auto;padding:22px;border-radius:26px;color:#14161c;text-shadow:none}
.sheet label{display:block;font-weight:600;font-size:13px;margin:10px 0 4px}
.sheet input,.sheet select,.sheet textarea{width:100%;padding:10px;border:1px solid rgba(20,22,28,.25);border-radius:12px;background:rgba(255,255,255,.75);font:inherit}
#coTotal{font-weight:800;font-size:17px}
.err{color:#c22;min-height:1em}
.row{display:flex;gap:10px;margin-top:10px}
#coPlace{background:#14161c;color:#fff;border:0;border-radius:999px;padding:12px 22px;font-weight:800;cursor:pointer;flex:1}
.ghostbtn{background:transparent;border:1px solid rgba(20,22,28,.3);border-radius:999px;padding:12px 18px;font-weight:700;cursor:pointer}
.tick{width:64px;height:64px;border-radius:50%;background:#0a7a4a;color:#fff;font-size:32px;display:flex;align-items:center;justify-content:center;margin:10px auto}
#coDone{text-align:center}
@media(max-width:767px){
  #arc{top:48%}
  /* model lifted above the buy card: its bottom edge sits just above the
     card, so the card never covers the model above the mid-thigh cut and
     the grey trousers stay visible below the garment */
  #figure{bottom:calc(4.6vh + 186px)}
  #topbar{padding:8px 14px;gap:8px;max-width:96vw}
  .brand{font-size:16px}
  .langbtn{padding:5px 10px}
  #tabs{overflow-x:auto;scrollbar-width:none}
  #tabs::-webkit-scrollbar{display:none}
  #tabs button{height:32px;padding:0 13px;font-size:12px}
  #prevBtn,#nextBtn{display:none}
  #rail{left:10px;top:auto;bottom:calc(4.6vh + 200px);transform:none}
  #rail button{width:34px;height:34px;font-size:16px}
  /* buy card: compact 3-row grid, no overlap in AR or EN.
     Row 1 thumb + name/price, row 2 sizes + quantity, row 3 colours + order.
     Grid areas follow dir, so in Arabic the whole card mirrors (RTL). */
  #buy{display:grid;grid-template-columns:52px 1fr auto;grid-template-areas:"thumb meta meta" "row2 row2 row2" "row3 row3 buy";gap:8px 10px;padding:10px 14px;align-items:center}
  #buyInfo{display:contents}
  #buyThumb{grid-area:thumb;width:52px;height:52px}
  #buyMeta{grid-area:meta;min-width:0}
  #buyRow2{grid-area:row2}
  #buyRow3{grid-area:row3}
  #buyBtn{grid-area:buy;height:40px;padding:0 14px;font-size:13px}
  #sizes button{width:28px;height:28px;font-size:12px}
  #qtyCol{display:block}
  .tag{display:none}
}
@media(prefers-reduced-motion:reduce){.card .sheen{display:none}.veil-spin{animation:none}}
