*{box-sizing:border-box}
html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#14291f;color:white;font-family:Arial}
canvas{display:block;width:100%;height:100%;touch-action:none}
#hud{position:fixed;top:14px;left:14px;right:14px;display:flex;justify-content:space-between;pointer-events:none;gap:8px}
#hud>div{display:flex;gap:8px}
#hud span{background:#10291dcc;border:1px solid #ffffff35;border-radius:15px;padding:10px 14px;font-weight:850;font-size:13px}
#toast{position:fixed;top:80px;left:50%;transform:translateX(-50%);background:#10291ddd;padding:12px 20px;border-radius:14px;font-weight:800;opacity:0;transition:opacity .2s}
#toast.show{opacity:1}
#help{position:fixed;bottom:14px;left:50%;transform:translateX(-50%);background:#10291dbb;border-radius:12px;padding:9px 13px;font-size:11px;white-space:nowrap}
#exit{position:fixed;top:75px;left:14px;color:white;text-decoration:none;background:#10291dcc;padding:9px 13px;border-radius:12px;font-weight:800}
#mobile-controls{display:none;position:fixed;inset:auto 16px 22px;justify-content:space-between;align-items:end;pointer-events:none}
#stick{width:150px;height:100px;position:relative;pointer-events:auto}
#stick button,#mobile-punch{position:absolute;border:1px solid #fff8;background:#163e2ddd;color:white;font-size:22px;font-weight:900;border-radius:15px;width:46px;height:44px;touch-action:none}
#stick button:nth-child(1){left:51px;top:0}
#stick button:nth-child(2){left:0;top:48px}
#stick button:nth-child(3){left:51px;top:48px}
#stick button:nth-child(4){left:102px;top:48px}
#mobile-punch{position:relative;pointer-events:auto;width:82px;height:82px;border-radius:50%;background:#f0a83b;color:#482b09;border:4px solid white;font-size:14px}
@media(max-width:800px),(pointer:coarse){#mobile-controls{display:flex}#help{bottom:145px;font-size:9px}}


/* Controles táctiles estilo Roblox */
#camera-touch{
 position:fixed;z-index:5;top:0;right:0;bottom:0;width:58%;
 touch-action:none;background:transparent;pointer-events:auto;
}
#mobile-controls{
 z-index:8;left:0;right:0;bottom:0;padding:0 20px 22px;
 display:none;justify-content:space-between;align-items:end;
 pointer-events:none;
}
#stick{
 width:150px;height:150px;position:relative;
 pointer-events:auto;touch-action:none;user-select:none;
}
#stick-base{
 position:absolute;inset:0;border-radius:50%;
 background:rgba(15,35,30,.48);
 border:3px solid rgba(255,255,255,.65);
 box-shadow:0 4px 18px #0006;
}
#stick-knob{
 position:absolute;width:66px;height:66px;left:50%;top:50%;
 transform:translate(-50%,-50%);border-radius:50%;
 background:linear-gradient(145deg,#f7fff8,#9cbda9);
 border:3px solid white;box-shadow:0 4px 12px #0008;
 pointer-events:none;
}
#mobile-punch{
 position:relative;z-index:9;pointer-events:auto;
 width:76px;height:76px;border-radius:50%;
 background:#f0a83b;color:#482b09;border:4px solid white;
 font-size:13px;font-weight:900;touch-action:none;
}
@media(max-width:800px),(pointer:coarse){
 #mobile-controls{display:flex}
 #help{bottom:175px;font-size:9px}
}

#mobile-punch{
 background:#16803c;
 color:#fff;
}


/* Controles transparentes */
#mobile-punch{
 background:rgba(15,25,35,.32) !important;
 color:#fff !important;
 border:2px solid rgba(255,255,255,.8) !important;
 box-shadow:0 3px 12px #0006;
 backdrop-filter:blur(7px);
 -webkit-backdrop-filter:blur(7px);
}


#z3d-install-modal{position:fixed;inset:0;z-index:99999;background:rgba(0,0,0,.82);display:flex;align-items:center;justify-content:center;padding:18px;font-family:Arial,sans-serif}
.z3d-install-card{position:relative;width:min(390px,100%);background:#101827;color:white;border:1px solid #f2a52e;border-radius:22px;padding:28px 22px;text-align:center;box-shadow:0 15px 60px #000}
.z3d-install-icon{width:65px;height:65px;border-radius:18px;background:#f2a52e;color:#101827;font-size:42px;font-weight:1000;display:grid;place-items:center;margin:0 auto 14px}
.z3d-install-card h2{font-size:23px;margin:8px 0 12px}
.z3d-install-card p{font-size:14px;line-height:1.5;color:#e1e6ef}
.z3d-install-button,.z3d-install-done{width:100%;padding:15px;margin-top:15px;border:0;border-radius:12px;background:#f2a52e;color:#101827;font-size:15px;font-weight:900}
.z3d-install-close{position:absolute;right:12px;top:8px;background:transparent;color:white;border:0;font-size:30px}
.z3d-install-note{font-size:12px!important;color:#ffd58c!important}
.z3d-ios-steps{text-align:left}
#help{display:none!important}


#exit,
#players {
  display: none !important;
}
/* JOTABOX: pantalla completa adaptable */
html,body{
 width:100%;
 height:100%;
 min-height:100%;
 margin:0!important;
 padding:0!important;
 overflow:hidden!important;
 position:fixed;
 inset:0;
 overscroll-behavior:none;
 touch-action:none;
}
body{
 height:100vh;
 height:100dvh;
}
canvas{
 position:fixed!important;
 inset:0!important;
 display:block!important;
 width:100%!important;
 height:100%!important;
 max-width:none!important;
 max-height:none!important;
 touch-action:none!important;
}
#camera-touch{
 position:fixed!important;
 inset:0 0 0 42%!important;
 width:auto!important;
 height:auto!important;
 touch-action:none!important;
}
#mobile-controls{
 position:fixed!important;
 left:0!important;
 right:0!important;
 bottom:env(safe-area-inset-bottom,0px)!important;
 padding-left:max(14px,env(safe-area-inset-left))!important;
 padding-right:max(14px,env(safe-area-inset-right))!important;
 z-index:20!important;
}
#hud{
 top:max(8px,env(safe-area-inset-top))!important;
 left:max(8px,env(safe-area-inset-left))!important;
 right:max(8px,env(safe-area-inset-right))!important;
 z-index:25!important;
}
#toast{z-index:30!important;max-width:90vw;text-align:center}
@media (orientation:portrait) and (max-width:800px){
 #mobile-controls{bottom:max(12px,env(safe-area-inset-bottom))!important}
 #stick{width:118px!important;height:118px!important}
 #stick-knob{width:54px!important;height:54px!important}
 #mobile-punch{width:68px!important;height:68px!important}
 #hud span{font-size:11px!important;padding:8px 10px!important}
}
@media (orientation:landscape) and (max-height:500px){
 #mobile-controls{padding-bottom:6px!important}
 #stick{width:92px!important;height:92px!important}
 #stick-knob{width:48px!important;height:48px!important}
 #mobile-punch{width:60px!important;height:60px!important}
}


/* Corrección Safari iPhone: evitar desbordamiento horizontal */
html,body{
 box-sizing:border-box!important;
 width:auto!important;
 max-width:100%!important;
 left:0!important;
 right:0!important;
 overflow:hidden!important;
}
canvas{
 box-sizing:border-box!important;
 position:fixed!important;
 inset:0!important;
 width:auto!important;
 height:auto!important;
 max-width:100%!important;
}
@supports (padding: env(safe-area-inset-right)){
 #hud{
  left:max(8px,env(safe-area-inset-left))!important;
  right:max(8px,env(safe-area-inset-right))!important;
 }
 #mobile-controls{
  left:0!important;
  right:0!important;
  padding-left:max(14px,env(safe-area-inset-left))!important;
  padding-right:max(14px,env(safe-area-inset-right))!important;
 }
}


/* JOTABOX_STORE_HUD */
#jotabox-store-indicator{
 position:fixed;z-index:27;left:max(10px,env(safe-area-inset-left));
 top:50%;transform:translateY(-50%);
 display:flex;align-items:center;gap:8px;
 padding:11px 13px;border:2px solid #ffe08a;border-radius:14px;
 background:rgba(20,35,55,.88);color:#fff;
 font:bold 14px Arial,sans-serif;letter-spacing:1px;
 box-shadow:0 3px 14px #0008;pointer-events:none;
}
#jotabox-store-arrow{
 display:inline-block;color:#ffd34e;font-size:23px;
 transform-origin:center;line-height:1;
}
#jotabox-store-button{
 position:fixed;z-index:35;left:50%;top:62%;
 transform:translate(-50%,-50%);
 padding:15px 30px;border:3px solid #fff2b0;border-radius:16px;
 background:linear-gradient(135deg,#ffdf65,#e99a22);
 color:#492600;font-size:18px;font-weight:1000;
 letter-spacing:1px;box-shadow:0 5px 20px #0009;
}
#jotabox-store-button[hidden]{display:none!important}

/* Ocultar el indicador lateral permanente de tienda */
#jotabox-store-indicator{display:none!important}


/* JOTABOX_AVATAR_STORE_UI */
#jotabox-avatar-store{
 position:fixed;inset:0;z-index:80;display:none;
 align-items:center;justify-content:center;
 padding:12px;background:rgba(5,10,20,.82);
 font-family:Arial,sans-serif;color:#fff;
}
#jotabox-avatar-store.open{display:flex}
.jotabox-store-window{
 width:min(900px,96vw);max-height:92dvh;overflow:auto;
 border:2px solid #e8bd62;border-radius:20px;
 background:linear-gradient(145deg,#18283d,#101827);
 box-shadow:0 18px 60px #000b;padding:16px;
}
.jotabox-store-header{
 display:flex;align-items:center;gap:12px;flex-wrap:wrap;
 padding-bottom:13px;border-bottom:1px solid #ffffff28;
 font-size:19px;
}
.jotabox-store-money{
 margin-left:auto;padding:9px 13px;border-radius:12px;
 background:#263e48;border:1px solid #68c9a0;
 color:#a8f2cb;font-size:14px;
}
.jotabox-store-money b{font-size:19px;margin-left:5px}
#jotabox-store-close{
 border:0;border-radius:10px;background:#713c43;color:white;
 font-size:19px;padding:8px 12px;
}
.jotabox-store-columns{
 display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);
 gap:18px;padding-top:14px;
}
.jotabox-store-columns h3{
 margin:4px 0 12px;font-size:15px;letter-spacing:1.5px;
 color:#f5d58b;
}
.jotabox-preview-stage{
 height:320px;max-width:100%;overflow:hidden;
 display:flex;align-items:center;justify-content:center;
 border-radius:15px;background:radial-gradient(ellipse,#52647c,#182536 75%);
}
#jotabox-preview-canvas{width:100%;height:320px;display:block}
#jotabox-preview-name{
 text-align:center;color:#f5d58b;font-weight:bold;
 font-size:13px;letter-spacing:1px;
}
.jotabox-avatar-card{
 display:flex;width:100%;align-items:center;gap:12px;
 padding:13px;border:2px solid #526177;border-radius:14px;
 background:#26364b;color:white;text-align:left;
}
.jotabox-avatar-card.selected{
 border-color:#f2c45f;background:#35445a;
}
.jotabox-avatar-icon{font-size:38px}
.jotabox-avatar-info{display:flex;flex:1;flex-direction:column;gap:5px}
.jotabox-avatar-info strong{color:#ffdb82;font-size:15px}
.jotabox-avatar-info small{color:#bdc9d8;font-size:11px}
.jotabox-avatar-check{font-size:20px;color:#a8f2cb}
.jotabox-store-note{
 margin-top:14px;padding:12px;border-radius:12px;
 background:#ffffff0c;color:#c6d0df;font-size:12px;line-height:1.5;
}
@media(max-width:600px){
 #jotabox-avatar-store{padding:7px}
 .jotabox-store-window{padding:11px;max-height:94dvh}
 .jotabox-store-header{font-size:15px;gap:7px}
 .jotabox-store-columns{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:9px}
 .jotabox-preview-stage{height:235px}
 #jotabox-preview-canvas{height:235px}
 .jotabox-avatar-card{padding:8px;gap:6px}
 .jotabox-avatar-icon{font-size:27px}
 .jotabox-avatar-info b{font-size:13px}
 .jotabox-avatar-info strong{font-size:12px}
 .jotabox-avatar-info small{font-size:10px}
 .jotabox-store-note{font-size:11px}
}

/* Vista previa de avatares transparente y centrada */
.jotabox-preview-stage{
 background:transparent!important;
 box-shadow:none!important;
 border:0!important;
 display:flex;
 align-items:center;
 justify-content:center;
 overflow:hidden;
}
#jotabox-preview-canvas{
 display:block;
 width:100%;
 height:100%;
 background:transparent!important;
}


/* Encuadre estricto del personaje en el panel izquierdo */
.jotabox-store-preview{
 min-width:0!important;
 width:100%!important;
 overflow:hidden!important;
}
.jotabox-preview-stage{
 position:relative!important;
 width:100%!important;
 height:320px!important;
 min-width:0!important;
 max-width:100%!important;
 overflow:hidden!important;
 display:block!important;
 background:transparent!important;
 border:0!important;
 box-shadow:none!important;
}
#jotabox-preview-canvas{
 position:absolute!important;
 inset:0!important;
 display:block!important;
 width:100%!important;
 height:100%!important;
 max-width:100%!important;
 background:transparent!important;
}
@media(max-width:600px){
 .jotabox-preview-stage{height:235px!important}
}\n
/* COMPRA Y LOGIN BAJO DEMANDA */
#jotabox-avatar-store #jotabox-buy-avatar{
 display:block;width:100%;margin:12px 0 4px;padding:13px;
 border:0;border-radius:10px;background:linear-gradient(135deg,#ffd45e,#f39b25);
 color:#202638;font-weight:900;font-size:15px;cursor:pointer
}
#jotabox-purchase-login{
 display:none;position:fixed;inset:0;z-index:20000;align-items:center;
 justify-content:center;padding:18px;background:#050b16dd;font-family:Arial,sans-serif
}
#jotabox-purchase-login.open{display:flex}
#jotabox-purchase-login section{
 position:relative;width:min(100%,360px);padding:26px 20px;
 border:1px solid #60738d;border-radius:16px;background:#142238;
 color:#fff;text-align:center;box-shadow:0 15px 50px #0009
}
#jotabox-purchase-login h3{margin:8px 0 12px;font-size:18px}
#jotabox-purchase-login p{font-size:13px;line-height:1.5}
#jotabox-purchase-login-close{
 position:absolute;right:10px;top:8px;border:0;
 background:transparent;color:#fff;font-size:22px;cursor:pointer
}
#jotabox-purchase-google-button{display:flex;justify-content:center;margin:18px auto 8px}


/* Controles de voz grupal global JOTABOX */
@media(max-width:600px){
}



/* JOTABOX_FACEBOOK_FULLSCREEN_V1: pantalla completa en navegadores integrados. */
html,body{
 width:100%!important;
 min-width:100%!important;
 max-width:none!important;
 height:100%!important;
 min-height:100%!important;
 max-height:none!important;
 margin:0!important;
 padding:0!important;
 overflow:hidden!important;
}
canvas{
 position:fixed!important;
 top:0!important;
 left:0!important;
 right:0!important;
 bottom:0!important;
 display:block!important;
 width:100vw!important;
 height:100vh!important;
 height:100dvh!important;
 min-width:100vw!important;
 max-width:none!important;
 min-height:100vh!important;
 max-height:none!important;
}


/* JOTABOX_ANDROID_TOUCH_FIX_V2 */
#mobile-controls,#stick,#stick-base,#stick-knob,#mobile-punch{
  touch-action:none!important;
  -webkit-user-select:none!important;
  user-select:none!important;
  -webkit-touch-callout:none!important;
  overscroll-behavior:contain!important;
}
#stick{
  -webkit-tap-highlight-color:transparent;
}

/* JOTABOX_FACEBOOK_TOUCH_JOYSTICK_V3 */
#stick,#stick-base,#stick-knob{
 touch-action:none!important;
 -webkit-user-select:none!important;
 user-select:none!important;
 -webkit-touch-callout:none!important;
}
#stick{pointer-events:auto!important;}


/* JOTABOX_INVISIBLE_TOUCH_ZONE_V1 */
@media (max-width:800px),(pointer:coarse){
 #camera-touch{
  inset:0 0 0 50%!important;
  width:50%!important;
  z-index:5!important;
 }
 #mobile-controls{
  display:block!important;
  position:fixed!important;
  inset:0!important;
  padding:0!important;
  z-index:20!important;
  pointer-events:none!important;
 }
 #stick{
  position:fixed!important;
  left:0!important;
  top:50%!important;
  bottom:auto!important;
  width:50vw!important;
  height:50vh!important;
  opacity:0!important;
  background:transparent!important;
  border:0!important;
  box-shadow:none!important;
  pointer-events:auto!important;
  touch-action:none!important;
  z-index:21!important;
 }
 #stick-base,#stick-knob{display:none!important;pointer-events:none!important}
 #mobile-punch{
  position:fixed!important;
  right:max(18px,env(safe-area-inset-right))!important;
  bottom:max(18px,env(safe-area-inset-bottom))!important;
  z-index:22!important;
  pointer-events:auto!important;
 }
}

/* JOTABOX_DYNAMIC_VISIBLE_STICK_V2 */
@media (max-width:800px),(pointer:coarse){
 #camera-touch{
  inset:0 0 0 50%!important;
  width:50%!important;
  z-index:5!important;
 }
 #mobile-controls{
  display:block!important;
  position:fixed!important;
  inset:0!important;
  padding:0!important;
  pointer-events:none!important;
  z-index:20!important;
 }
 #stick{
  position:fixed!important;
  left:0!important;
  top:50%!important;
  width:50vw!important;
  height:50vh!important;
  opacity:1!important;
  background:transparent!important;
  border:0!important;
  box-shadow:none!important;
  pointer-events:auto!important;
  touch-action:none!important;
  z-index:21!important;
 }
 #stick-base{
  display:none;
  position:absolute!important;
  width:130px!important;
  height:130px!important;
  inset:auto!important;
  border-radius:50%!important;
  background:rgba(20,35,30,.38)!important;
  border:2px solid rgba(255,255,255,.72)!important;
  box-shadow:0 3px 15px #0007!important;
  pointer-events:none!important;
 }
 #stick-knob{
  display:block!important;
  width:58px!important;
  height:58px!important;
  left:50%;
  top:50%;
  background:linear-gradient(145deg,#fff,#a9c4b5)!important;
  border:2px solid white!important;
  pointer-events:none!important;
 }
 #mobile-punch{
  position:fixed!important;
  right:max(18px,env(safe-area-inset-right))!important;
  bottom:max(18px,env(safe-area-inset-bottom))!important;
  z-index:22!important;
  pointer-events:auto!important;
 }
}

/* JOTABOX_STICK_EXACT_FINGER_POSITION_V3 */
@media (max-width:800px),(pointer:coarse){
 #stick{
  left:0!important;
  top:0!important;
  width:50vw!important;
  height:100vh!important;
  opacity:1!important;
  pointer-events:auto!important;
 }
 #stick-base{
  position:fixed!important;
  width:130px!important;
  height:130px!important;
  margin:0!important;
  z-index:100!important;
  pointer-events:none!important;
 }
 #stick-knob{
  display:block!important;
  pointer-events:none!important;
 }
}

/* JOTABOX_STICK_EXACT_FINGER_POSITION_V3 */
@media (max-width:800px),(pointer:coarse){
 #stick{
  left:0!important;
  top:0!important;
  width:50vw!important;
  height:100vh!important;
  opacity:1!important;
  pointer-events:auto!important;
 }
 #stick-base{
  position:fixed!important;
  width:130px!important;
  height:130px!important;
  margin:0!important;
  z-index:100!important;
  pointer-events:none!important;
 }
 #stick-knob{
  display:block!important;
  pointer-events:none!important;
 }
}


/* JOTABOX_JOYSTICK_PERMANENT_DEMO_V1 */
@media (max-width:800px),(pointer:coarse){
 #stick::before{
  content:"";
  display:block;
  position:fixed;
  left:55px;
  bottom:48px;
  width:88px;
  height:88px;
  box-sizing:border-box;
  border-radius:50%;
  background:rgba(20,35,30,.42);
  border:3px solid rgba(255,255,255,.72);
  box-shadow:0 4px 18px #0008;
  pointer-events:none;
  z-index:23;
 }
 #stick::after{
  content:"";
  display:block;
  position:fixed;
  left:81px;
  bottom:74px;
  width:36px;
  height:36px;
  box-sizing:border-box;
  border-radius:50%;
  background:linear-gradient(145deg,#fff,#a9c4b5);
  border:2px solid white;
  box-shadow:0 3px 12px #0008;
  pointer-events:none;
  z-index:24;
 }
 #stick.active::before,
 #stick.active::after{
  display:none;
 }
}


/* JOTABOX_JOYSTICK_UNIFICADO_FINAL */
@media (max-width:800px),(pointer:coarse){
  #stick{
    position:fixed!important;
    left:0!important;
    top:0!important;
    right:auto!important;
    bottom:auto!important;
    width:50vw!important;
    height:100vh!important;
    height:100dvh!important;
    opacity:1!important;
    background:transparent!important;
    border:0!important;
    box-shadow:none!important;
    pointer-events:auto!important;
    touch-action:none!important;
    z-index:30!important;
  }
  #stick-base{
    position:fixed!important;
    width:130px!important;
    height:130px!important;
    box-sizing:border-box!important;
    margin:0!important;
    border-radius:50%!important;
    background:rgba(20,35,30,.42)!important;
    border:2px solid rgba(255,255,255,.75)!important;
    box-shadow:0 3px 15px #0007!important;
    pointer-events:none!important;
    z-index:31!important;
  }
  #stick-knob{
    position:absolute!important;
    left:50%;
    top:50%;
    width:58px!important;
    height:58px!important;
    transform:translate(-50%,-50%)!important;
    border-radius:50%!important;
    background:linear-gradient(145deg,#fff,#a9c4b5)!important;
    border:2px solid white!important;
    box-sizing:border-box!important;
    pointer-events:none!important;
  }
}
/* FIN JOTABOX_JOYSTICK_UNIFICADO_FINAL */
